Re: How do you like this SQL?

From: John Hurley <>
Date: Fri, 14 Dec 2012 12:09:45 -0800 (PST)
Message-ID: <>


# Particularly when one needs to get "the most recent/least recent/ highest/lowest row" for a set of data, the best approach is not always obvious.

Yeah working on this now with the developer ... kinda confused ... asked to get a clear english language statement of what they were trying to accomplish. Unforunately just got "pretty sure it has to work like the SQL is right now ... I don't remember why I coded all these other outer joins" ...

It is one of these borderline weird data cases where you apparently get a few more rows "sometimes" by doing group by on all the other columns and one max.

Runs really fast when formulated yanking out the WHERE ( mult cols ) IN ( select against same table ) ... so may cope by adding a little smarts to the calling code to just look at first one ( in certain cases ) ... and adjustments to final order by statement ...

Still a work in progress here ... Received on Fri Dec 14 2012 - 21:09:45 CET

Original text of this message