我在我的DB 3 col中,我想在所有这些中找到一个值作为explainind:table name:MyTable
-----------------------------
--id-- col1-- col2-- col3-
-----------------------------
1 200 300 400
2 100 150 300
3 800 102 20
4 80 80 0
Run Code Online (Sandbox Code Playgroud)
我希望col1 col2 col3的结果为= 0,这是它们中的最小值.可能吗 !!!!
我的尝试:
select Min(col1, col2 , col3) as Tablemin
from MyTable
Run Code Online (Sandbox Code Playgroud)
ANSI SQL:
select min(col)
from
(
select col1 [col] from MyTable
union all
select col2 from MyTable
union all
select col3 from MyTable
)t
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5703 次 |
| 最近记录: |