Re: using max() aggregate

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ldm(at)apartia(dot)ch
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: using max() aggregate
Date: 2000-06-16 06:05:53
Message-ID: 5791.961135553@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Louis-David Mitterrand <cunctator(at)apartia(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Meskes 2000-06-16 06:09:00 Re: Crosstab SQL Question
Previous Message Louis-David Mitterrand 2000-06-16 05:50:15 using max() aggregate