Answer the question
In order to leave comments, you need to log in
How to get max value field from Mysql row?
There is a user_counters table like
ID | count_1 | count_2
---------------------------
1 | 2 | 3
2 | 6 | 3
WHERE id=1
WHERE id=2
SELECT cu.`count_1` `c1`, cu.`count_2` `c2` FROM `user_counters` `cu` WHERE cu.`id` = 1
Answer the question
In order to leave comments, you need to log in
SELECT IF(cu.`count_1` > cu.`count_2`, cu.`count_1`, cu.`count_2`) as maxcount FROM `user_counters` `cu` WHERE cu.`id` = 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question