I have a table as follow:
user_id value1 value2 value3 value4
1 2 3 4 null
2 null 5 2 null
3 null null 100 3
...
Now I want to get the minimum of value1, value2, value3 and value4 and then return the user_id with the highest minimum.
I thought about using least and then group by descending, but how do I efficiently check for null?
The output for the table would be:
user_id value
3 3
1 2
2 2
~0>>1will give you the biggest BigInt value in mysql (should be enough)or you have to do combinations (I put them all, not sure it’s necessary)
, 0)