Re: using max() aggregate - Mailing list pgsql-general

From Tom Lane
Subject Re: using max() aggregate
Date
Msg-id 5791.961135553@sss.pgh.pa.us
Whole thread Raw
In response to using max() aggregate  (Louis-David Mitterrand <cunctator@apartia.ch>)
Responses Re: using max() aggregate  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-general
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> I am trying to return the most recently updated record from a table:
> SELECT max(stopdate) FROM auction;
> and this works but only returns the timestamp, however if I try to get
> another column with the aggregate it fails:

Perhaps

select * from auction order by stopdate desc limit 1;

In 7.0 this should even be pretty quick, if you have an index on
stopdate.

            regards, tom lane

pgsql-general by date:

Previous
From: Louis-David Mitterrand
Date:
Subject: using max() aggregate
Next
From: Tom Lane
Date:
Subject: Re: Re: Crosstab SQL Question