Re: Can this be done in one query?

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Randall Perry <rgp(at)systame(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Can this be done in one query?
Date: 2002-05-08 14:48:16
Message-ID: 3CD93AB0.AEDC2398@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Or maybe if date_time is of type timestamp:

select date( select date_time from log order by date_time desc limit 1);

JLL

Stephan Szabo wrote:
>
> On Tue, 7 May 2002, Randall Perry wrote:
>
> > With the following:
> >
> > select max(date) from log order by date_time desc limit 12;
> >
> > The limit clause has no effect on the results; it'll get the latest date
> > from the entire record set rather than from the last 12 records.
>
> Maybe something like:
> select max(date) from (select date from log order by date_time desc limit
> 12) c;
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Darko Prenosil 2002-05-08 14:54:22 Fw: C trigger
Previous Message Jean-Luc Lachance 2002-05-08 14:37:34 Re: NOT IN query issues