erland wrote: 
> You can do it with exists directive and an inner select, something like
> this:
> 
> > 
Code:
--------------------
  >   > -- PlaylistName:Random temp
  > -- PlaylistGroups:
  > select tracks.url from tracks
  >     join genre_track on
  >             tracks.id=genre_track.track
  >     join genres on
  >             genre_track.genre=genres.id
  >     left join dynamicplaylist_history on
  >             tracks.id=dynamicplaylist_history.id and 
dynamicplaylist_history.client='PlaylistPlayer'
  >     where
  >             audio=1
  >             and dynamicplaylist_history.id is null
  >             and genres.name in ('Jazz')
  >             and exists (select track from genre_track
  >                     join genres on
  >                             genre_track.genre=genres.id
  >                     where
  >                             genres.name in ('Holiday')
  >                             and genre_track.track = tracks.id)      
  >     group by tracks.id
  >     order by random()
  >     limit 10;
  > 
--------------------
> > 
> 
> Please note that inner selects could be slow in large libraries, in
> that case there is might also a possibility to do it through an extra
> set of joins.

Many, many thanks for this! I probably don't know enough to make use of
your suggestion yet, but I'll certainly see if my heavy-handed cut and
paste efforts can make it work. But know that it's possible should be
the inspiration I need to learn how to make it work. Something like this
was what I was thinking of when I referred to "nested queries".


------------------------------------------------------------------------
RobbH's Profile: http://forums.slimdevices.com/member.php?userid=67008
View this thread: http://forums.slimdevices.com/showthread.php?t=109818

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

Reply via email to