有没有办法找到3个不同列的最大值?我正在尝试查找任何 3 列值高于指定值的记录,并试图避免在查询中做出这样的事情:
column1 > 69 or column2 > 69 or column3 > 69
表结构是这样的:
id | column1 | column2 | column3
1 | 5 | 4 | 3
2 | 70 | 1 | 65
3 | 66 | 3 | 90
并像这样选择:
select id from tablex where column1 > 69 or column2 > 69 or column3 > 69
-- but with better query, a bit prettier like this (it doesn't work of course)
select id from tablex where MAX(column1, column2, column3) > 69