Max versus Greatest in Oracle
So I was trying to figure out the greatest of three dates in oracle. They were coming from 3 different columns across three different tables. So I figured I could do something like the followingSELECT MAX(A.date, B.date, C.date) FROM. . .etc
But apparently that doesn't work. The max function will not work across multiple columns. That's when I learned about the greatest function. Does the same thing as max, but lets you do it across multiple columns. The above query became
SELECT GREATEST(A.date, B.date, C.date) FROM . . .etc.
So, Max = one column, Greatest = multiple columns.
Labels: Oracle
posted by Tom Becker at
12/03/2008
![]()

0 Comments:
Post a Comment
<< Home