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