PostGres if query?

Posted by KnockKnockWhosThere on Stack Overflow See other posts from Stack Overflow or by KnockKnockWhosThere
Published on 2010-04-26T20:21:50Z Indexed on 2010/04/26 20:23 UTC
Read the original article Hit count: 251

Filed under:
|
|

Is there a way to select records based using an if statement?

My table looks like this:

id | num | dis 
1  | 4   | 0.5234333
2  | 4   | 8.2234
3  | 8   | 2.3325
4  | 8   | 1.4553
5  | 4   | 3.43324

And I want to select the num and dis where dis is the lowest number... So, a query that will produce the following results:

id | num | dis 
1  | 4   | 0.5234333
4  | 8   | 1.4553

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about if