1 Answer
1

The Left Join in combination with j2.id IS NULL returns only those rows of j1, where no row of j2 can be found.

Since the condition is j1.changedone < j2.changedone, it returns only the rows with the highest changedone per trackid (if there is more than one row with this value of changedone for a trackid, all of them are returned).

So if you have

trackid changedone
1 1
1 2
2 1

You will get

trackid changedone
1 2
2 1

since for 1 - 1 the Left Join finds a record (1 - 2), so j2.id is NOT NULL.

That means if I have multiple values of trackid 1 and 2 both then they will displayed as per maximum changedone value first and then less than that and so on ???
–
OM The EternityMay 10 '10 at 6:11

1

@OM: Not sure if I understand your comment. As long as changedone is unique per trackid you will get only one row per trackid, the one with the highest value of changedone.
–
Peter LangMay 10 '10 at 6:13