Re: Help with minimum/group by
Rick's solution should work. It may even be quick, and perhaps there's no good reason not to use it - but I don't know; relying on a quirk of the GROUP BY clause (that it hangs on to the 'first one' in the list) just doesn't seem right.
To my mind, this represents a purer (if somewhat old-fashioned) solution...
SELECT x.*
FROM
(
SELECT *,ABS(b-14.3) dist FROM abc
) x
LEFT
JOIN
(
SELECT *,ABS(b-14.3) dist FROM abc
) y
ON x.c = y.c
AND x.dist > y.dist
WHERE y.a IS NULL;
Subject
Written By
Posted
November 08, 2009 12:04AM
November 08, 2009 05:07AM
November 08, 2009 11:37AM
November 08, 2009 03:37PM
Re: Help with minimum/group by
November 08, 2009 05:55PM
November 08, 2009 06:10PM
November 08, 2009 06:23PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.