Total page Hits: 10064   Receive Total of Visitors: 9598 since January 2021© radiodj.info 2012 - 2021 All rights reserved. Site Disclaimer     
Home Search
query Rotation This page was last modified on 19 October 2021 11:10

There is 1 visitor on this page.   Most visitors on this page same time: 4 on February 1st, 2021

Query rotations

    L/R
  • New query.
  • Open a query sql file.
  • Save the new or adjusted query.


    Run (test) query.


    Show category list.
    (for song type, song_type = Num)


    Show subcategory list.
    (id_subcat = Num)


    Show genres list.
    (id_genre = Num)

Sample query:

Rotation from a query.

You need some knowledge about sql.
is very user-friendly, with a good explanation of how.

A query line looks like:

SELECT ID, year, path FROM songs WHERE $ForceRepeatRules$ AND year >='1970' and year < '1990' ORDER BY rand() LIMIT 3;


A Query line standard contents:

My list

  1. SELECT = What to select.
  2. FROM = From which table (in this case often from the songs table).
  3. WHERE = Where to start for equals.
  4. AS (See AND on next check)

  5. $ForceRepeatRules$ = A pre divined rule made by Marius (there are more in the screen).
  6. AND = Also look at.
  7. ORDER BY = Order by rand() This is used for random selecting
  8. GROUP BY = (Not in the list ) (Make groups to select).
  9. ACS= Sort from A to Z (Not in the list but usefully).
  10. DECS = Sort from Z to A (Not in the list but usefully).
  11. LIMIT = Limit it to max lines for selections in the query.
  12. -- = A comment line for explanation see examples.
  13. song_type = 0    Important if it's a song track.
  14. enabled = 1     (important if the song track can play (if not is set as disabled or not is set as not found on the special set drive in the database (error is like not the correct path in your songs table). )
What is capitalized red in the list must also be used in the query line with capital letters!


example #1

-- ADD 3 TRACKS WITH SWEEPER FROM 1970 TO 1989

SELECT ID, year, path FROM songs WHERE $ForceRepeatRules$ AND year >='1970' AND year < '1990' ORDER BY rand() LIMIT 3;
$SweeperOnStart$




example #2

-- PLAY TWO TRACKS FROM THE SAME ARTIST AND EXCLUDE ARTISTS THAT ARE ALREADY IN THE PLAYLIST.

SELECT ID, artist, title FROM songs WHERE artist=( SELECT songs.artist FROM songs WHERE songs.enabled=1 AND songs.song_type=0 GROUP BY `songs`.`artist` HAVING COUNT(*) > 1 ORDER BY `songs`.`date_played` ASC LIMIT 1) AND `enabled`=1 AND `song_type`=0 ORDER BY `date_played` ASC LIMIT 2;
$SweeperOnStart$





example #3

-- ADD 10 MOST PLAYED TRACKS TO THE PLAYLIST

SELECT `ID` FROM `songs` WHERE `song_type`=0 AND `enabled`= '1' ORDER BY `count_played` DESC LIMIT 10;




example #4

-- ADD 10 TRACKS OF AN ARTIST TO THE PLAYLIST

SELECT `ID` FROM `songs` WHERE `artist`='term' LIMIT 10;




example #5

-- ADD 10 MOST PLAYED TRACKS FROM SAME GENRE TO THE PLAYLIST -- id_genre = Genre number

SELECT `ID` FROM `songs` WHERE `song_type`=0 AND `enabled`= '1' AND `id_genre` = '8' ORDER BY `count_played` DESC LIMIT 10;



In c:\RadioDJv2\SQL Rotation Examples\ Are some query's to use.
TIP: Store/Save your query's in it to!


Some rotation examples for .