dSw;151675 Wrote: 
> Can anyone see anything obviously wrong with this query or suggest an
> alternative way of doing it?I think the problem is that mysql re-executes the 
> inner SQL for every
row in the main SQL, so this results in that you need to get very lucky
to get any hit at all.

Something like this seems to work for me:
> 
> select tracks.url
> from tracks, (select distinct albums.id
>       from tracks, albums, genre_track, genres
>       where genres.name = 'Mix'
>               and genre_track.genre=genres.id
>               and tracks.id = genre_track.track
>               and tracks.album = albums.id
>               and albums.titlesort not in ('NO TITLE','N/A','UNKNOWN 
> ALBUM','NO
> ALBUM')
>               order by rand() limit 1) as albums
> where tracks.album = albums.id
> order by tracks.disc, tracks.tracknum;
>


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-trackstat)
, 'SQLPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-sqlplaylist)
, 'DynamicPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-dynamicplaylist),
'Custom Browse'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-custombrowse),'Custom
Scan'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-customscan)
and 'RandomPlayList'
(http://erland.homeip.net/download/do/viewapplication?name=slimserver-randomplaylist)
plugins)
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=20533

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to