I want to get the maximum value of 2 Integer (or 2 float).
I know I can do it with a IF function like this: IF (column1 > column2, column1, column2)
however I was wondering if a function to do that exists or if there is a plan to add that kind of function in the future.
In MySQL there is the GREATER function that can do that. Example: GREATER(column1, column2).
MAX DescriptionReturns the maximum value of non- NULL expressions. Returns NULL if there are zero input rows or expression evaluates to NULL for all rows. Returns NaN if the input contains a NaN .
Comparing strings To do that we can use one of the STRING comparison functions: STARTS_WITH(value1, value2)-> Returns True/False if value1 starts with the substring value2.
ARRAY_AGG. Returns an ARRAY of expression values. To learn more about the optional arguments in this function and how to use them, see Aggregate function calls.
COALESCE(expr[, ... ]) Description. Returns the value of the first non-null expression. The remaining expressions are not evaluated.
BigQuery supports
GREATEST(expr1, expr2, ...)
which returns the largest argument. I've filed an internal bug to get this added to our public documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With