What's the best way to select the minimum value from several columns?

后端 未结 19 2127
余生分开走
余生分开走 2020-11-27 02:47

Given the following table in SQL Server 2005:

ID   Col1   Col2   Col3
--   ----   ----   ----
1       3     34     76  
2      32    976     24
3       7             


        
19条回答
  •  情歌与酒
    2020-11-27 03:36

    If you know what values you are looking for, usually a status code, the following can be helpful:

    select case when 0 in (PAGE1STATUS ,PAGE2STATUS ,PAGE3STATUS,
    PAGE4STATUS,PAGE5STATUS ,PAGE6STATUS) then 0 else 1 end
    FROM CUSTOMERS_FORMS
    

提交回复
热议问题