1

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?

unique2
  • 2,162
  • 2
  • 18
  • 23

1 Answers1

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