max(expression) is an aggregate function
(from the manual: maximum value of expression across all input
values)
greatest(value [, ...]) is not an aggregate function
(from the manual: The GREATEST function selects the largest value from
a list of any number of expressions.)
So max takes the
Ruben Gouveia wrote:
What is the difference between these two. I know that max() is an
aggregate function
... and greatest() is a normal single-row function.
One works vertically, one works horizontally, if that helps you. :-)
Or max() is like sum() and greatest is like +.
--
Sent via
Thanks Bart,
Your explanation is great. Returned and Bought are of datatypes date, hence
Returned would be a more recent value.
On Fri, Sep 12, 2008 at 12:10 AM, Bart Degryse [EMAIL PROTECTED]wrote:
max(*expression*) is an aggregate function
(from the manual: maximum value of *expression*
What is the difference between these two. I know that max() is an aggregate
function
select model,count(distinct cars)
from rc_cars
where greatest(baught,returned) current_date - integer '1'
group by model;
Do i need to have a max () around a greatest() to make sure i get the most
recent of the