MySQL greatest value in row?

Posted by noryb009 on Stack Overflow See other posts from Stack Overflow or by noryb009
Published on 2010-04-21T23:34:07Z Indexed on 2010/04/21 23:43 UTC
Read the original article Hit count: 132

Filed under:
|
|

Hi! I'm using MySQL with PHP. This is like my table: (I'm using 3 values, but there are more)

id | 1 | 2 | 3
1  | 3 |12 |-29
2  | 5 |8  |8
3  | 99|7  |NULL

I need to get the greatest value in a certain row. If should get: (id -> output) (1 -> 2), (2->2), (3->1). Is there any queries for this? I've been trying, but I can't get it to work right.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php