![]() | |
#21
| |||
| |||
|
|
snip Could you say if this is the solution: In the case were albums share tracks, release date and display orders i have to group by t.track_id and use a function like MIN(a.display_order)... right?... just to make sure i'm not messing things up.... /snip Yes, but only if the display order for both tracks is different! snip The other thing is the tracks with no albums, they don't show up. Any idea why? /snip Is this true for all the examples? It's usually because a WHERE condition has been applied to an OUTER JOIN table, in which case change the WHERE condition to an ON condition. |
#22
| |||
| |||
|
#23
| |||
| |||
|
|
Thinking about it further, I see there's a flaw in solutions 1 & 3 The full specification (as I understand it) reads like this: Give me a list of all distinct tracks, their associated albums, the album release dates, and album artwork. In the event that a track exists on more than one album, give me only the album and release date of the earliest release. In the event that a track exists on two or more albums which sharing identical earliest release dates, give me the album with the lowest display order. In the event that a track exists on no albums, just give me the track. As far as I can tell, query 2 (the 'hack') fulfils all these criteria, but let me know if there's still a problem. |
![]() |
| Thread Tools | |
| Display Modes | |
| |