On Sat, 1 Sep 2001, Rainer Clasen wrote:
> This jukebox should offer a random play mode. It should take into account
> when the title was played the last time. My Idea is to submit the query
> returning the records ordered by their last time of play, ignore a random
> number of records, fetch one record and drop the result set.
>
> I'm wondering wether there is a more elegant way to fetch a random record
> from a result.
Sure, well, try this:
SELECT whatever FROM whereever WHERE whatever ORDER BY random() limit 5;
replace whatever and whereever with your selection criterie -- the order
by random() will randomise the results and limit 5 chooses only the first
5.
--
Tod McQuillin