Also, how can you query only artists who have songs (ie. assume that some artists have no tracks, or tracks but no songs on the tracks [weird example with music as a metaphor, but happens in other situations]), or artists who only have a minimum number of songs? eg in plain english query language: "artists where songs count > 20"
On Thursday, April 16, 2015 at 11:36:25 AM UTC-4, Andrew Burleson wrote: > > Sorry to ask what is probably a very basic SQL question... > > Let's say you have a two-level one to many association: > > Artist.one_to_many :albums > Album.one_to_many :songs > > How could you select all songs that belong to the artist? And how could > you order that query by number of songs? > > I'm using Postgres if that makes any difference. > > Thanks! > Andrew > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
