Fwd: Stalled post to pgsql-sql - Mailing list pgsql-sql

From Aaron Bono
Subject Fwd: Stalled post to pgsql-sql
Date
Msg-id bf05e51c0606011142i1e262a37m2bfe5baef59a476a@mail.gmail.com
Whole thread Raw
List pgsql-sql
I think this approach will only work if each broadcast_id has the same
maximum date_sent value.  You really need to do the group by in a
sub-query to bring the broadcast_id together with the max date_sent.

-Aaron Bono

On 6/1/06, Yasir Malik <ymalik@cs.stevens.edu> wrote:
> > What I would like to do is simply get the last date_sent and it's
> > status for every broadcast.  I can't do a GROUP BY because I can't put
> > an aggregate on the status column.
> >
> > SELECT MAX(date_sent), status
> > FROM broadcast_history
> > GROUP BY broadcast_id
> >
> You could try the following:
> select status
>    from broadcast_history bh
>   where bh.date_sent =
>         (select max(bh2.date_sent)
>            from broadcast_history bh2);
>


pgsql-sql by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: Am I crazy or is this SQL not possible
Next
From: "filippo"
Date:
Subject: datestyle on windows environment: how to set?