• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

SQL Query Help

Started by Nitrofish, March 16, 2015, 02:30:32 PM

Nitrofish

Many thanks TQ. I would consider myself a novice at these queries. I would say you are more advanced than a novice. Having said that, perhaps Marius could help us understand how to make it choose an Artist at random? Maybe I should spell his name wrong? He answered the last time I made that mistake. :hihi: What do you say Marius... any help would be appreciated.
RadioDJ v2.0.0.6 | MariaDB v10.5

TQ

Hi Nitro

What I should have made more clear in my last post is that it's a matter of criteria that stops me randomising the selection.

The criteria we've set is this:

Song is enabled
It is from a specific category
It falls within a specific date range (or has never been played)
It has not been played within the past 90 minutes
and finally, it is from a list (either 1st or second) that is sorted with the oldest at the top
(I also think it should be refined to make sure that the artist hasn't been played for a given time but we'll get back to that).

The problem is, with such strict criteria something has to give, it's a matter of you deciding what.

For example, you cannot ask the script to choose the the two oldest 'date_played' then make a random selection. Do you understand what I'm saying?

TQ
A problem is only a problem if you can't find the solution.

wrm

MYSQL Supports this.


SELECT * FROM `table` ORDER BY RAND() LIMIT 0,1;

Obviously modify the select according to your specific needs


Bill