MySQL Forums
Forum List  »  Newbie

Re: Help with minimum/group by
Posted by: Vadim Kiryukhin
Date: November 08, 2009 05:07AM

if you need just one record:
SELECT a, b, abs(14.3-b) AS c FROM closest ORDER BY c LIMIT 1;

if you need all min records:
SELECT a, b, abs(14.3-b) AS c FROM closest WHERE abs(14.3-b) = (SELECT MIN(abs(14.3-b)) FROM closest);


hope this helps,

-Vadim Kiryukhin

Options: ReplyQuote


Subject
Written By
Posted
November 08, 2009 12:04AM
Re: Help with minimum/group by
November 08, 2009 05:07AM
November 08, 2009 11:37AM
November 08, 2009 03:37PM
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.