I am trying to get the minimum of a couple of fields within a row with presto. In other SQL implementations like MySql this function is called LEAST. What is the equivalent function in Presto?
Asked
Active
Viewed 773 times
1 Answers
2
Since Presto 0.100 you can use least
:
SELECT LEAST(a, b);
For versions prior to that, use this equivalent:
SELECT (CASE WHEN a > b THEN b ELSE a END);

Piotr Findeisen
- 19,480
- 2
- 52
- 82

Damien Carol
- 1,164
- 1
- 11
- 21