Determining the maximum common value form a single row in MySQL
I have a table like this:
-----+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+------------
r_id | r_user| module | q_1 | q_2 | q_3 | q_4 | q_5 | q_6 | q_7 | q_8 | q_9
-----+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+------------
1 | test | 1 | g | r | r | y | g | g | y | r | g
-----+--------+--------+-----+-----+-----+-----+-----+-----+-----+-----+------------
2 | test-2| 1 | r | r | g | r | r | y | y | r | g
Is there any way to determine the maximum common value for each row? For
example, the first row should result "g" and the second row should result
"r".
I can't figure it out how to do that in MYSQL. Any help on that?
No comments:
Post a Comment