SELECT '1000000' AS number
UNION ALL
SELECT '541' AS number
UNION ALL
SELECT '-500' AS number
UNION ALL
SELECT '100' AS number
UNION ALL
SELECT number, 'biggest' AS result
WHERE number = 1000000
How to make this work? My task is to find the biggest number from those that I added.
SELECT '1000000' AS number
UNION ALL
SELECT '541' AS number
UNION ALL
SELECT '-500' AS number
UNION ALL
SELECT '100' AS number
UNION ALL
SELECT number, 'biggest' AS result
WHERE number = 1000000
How to make this work? My task is to find the biggest number from those that I added.
You need to wrap the query in a derived table to be able access a column alias
But to find the highest number, you can use an
order byandlimit:Alternatively you can also simplify this by using a VALUES clause: