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; gnari ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq