I have three decimal columns named list1,list2,list3. I want to find the minimum of three in a single query.
I've tired this:
SELECT Least(list1, list2, list3)
FROM table1
It throws an error that least
is not recognized function.
I have three decimal columns named list1,list2,list3. I want to find the minimum of three in a single query.
I've tired this:
SELECT Least(list1, list2, list3)
FROM table1
It throws an error that least
is not recognized function.
4条答案
按热度按时间bfhwhh0e1#
Try using
UNION
UPDATE 1
SQLFiddle Demo
odopli942#
other solution,
jutyujz03#
This will work if there is more than 1 row in the table
t1qtbnec4#
As of SQL Server 2022 (and Azure SQL Database), you can use LEAST() function.
https://learn.microsoft.com/en-us/sql/t-sql/functions/logical-functions-least-transact-sql?view=azure-sqldw-latest