SQL Server equivalent to Oracle LEAST?

前端 未结 2 1755
我在风中等你
我在风中等你 2020-12-07 04:40

I\'ve been looking for a good equivalent to the Oracle LEAST function.

I\'m hoping to implement a user defined function that does about 10 fairly complex calculation

相关标签:
2条回答
  • 2020-12-07 05:27

    mayby this query could help:

     SELECT  min(c1)  
     from ( 
          select expression1 as c1  
          union all
          select expression2 as c1 
          union all 
          select expression3 as c1
     )
    
    0 讨论(0)
  • 2020-12-07 05:28

    The function Least() is applied horizontally in Oracle (on a row level), while Min() is applied vertically over a column. The example in the question required Min().

    0 讨论(0)
提交回复
热议问题