Reputation: 351
i want to know how to get max value ini 2 colomn ini mysql, for example data like this :
table_a : Filed : value 1, value2,value 3
and i want to get max value between value1,value2,value3 form table_a .
please somebody can help me. thanks.
Upvotes: 0
Views: 56
Reputation: 128
You may want to use the GREATEST() function:
SELECT GREATEST(value2, value2, value3);
But to get absolute maximum from all the rows, you may use:
SELECT GREATEST(MAX(value1), MAX(value2), MAX(value3)) FROM table_a;
Upvotes: 1