Re: select & group by - Mailing list pgsql-sql

From Michael L. Hostbaek
Subject Re: select & group by
Date
Msg-id 20050404122334.GM23648@mich2.itxmarket.com
Whole thread Raw
In response to Re: select & group by  (Ragnar Hafstað <gnari@simnet.is>)
List pgsql-sql
Ragnar Hafstað (gnari) writes:
> On Mon, 2005-04-04 at 10:47 +0000, Ragnar Hafstað wrote:
> > On Mon, 2005-04-04 at 12:16 +0200, Michael L. Hostbaek wrote:
> > > [problem]
> > [slightly broken solution]
> 
> I forgot a FROM clause, and you might want to add a
> ORDER BY clause, if that is important:
> 
> select part,mfg,
>        sum(CASE WHEN eta is NULL then qty ELSE 0 END) as qty,
>        sum(CASE WHEN eta is NULL then 0 ELSE qty END) as "qty incoming",
>        max(price) as "highest price",
>        min(eta) as eta
> from thetable
> group by part,mfg
> order by part,mfg;

Thanks, this works brilliantlty !

/mich



pgsql-sql by date:

Previous
From: Ragnar Hafstað
Date:
Subject: Re: select & group by
Next
From: lucas@presserv.org
Date:
Subject: Chield Serial