Re: [SQL] select with group by problem

From: neko(at)kredit(dot)sth(dot)szif(dot)hu
To: kaiq(at)realtyideas(dot)com
Cc: Stephan Bauer <stephan_bauer(at)gmx(dot)de>, pgsql-sql(at)postgreSQL(dot)org, Dietmar Kling <dietmar(dot)kling(at)sam-net(dot)de>
Subject: Re: [SQL] select with group by problem
Date: 1999-12-17 15:55:55
Message-ID: Pine.LNX.4.10.9912171650470.23844-100000@kredit.sth.szif.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> > xtra=> select * from warenkorb;
> > cookie|datum|artnr|artnr1|artnr2|artikelname|farbe|groesse|menge|preis
> > ------+-----+-----+------+------+-----------+-----+-------+-----+-----
> > (0 rows)
> >
> > xtra=> SELECT artnr, artnr1, artnr2, artikelname, farbe, groesse, SUM(
> > menge ),
> > preis FROM warenkorb WHERE cookie = 'asdfasdf' GROUP BY artnr, artnr1,
> > artnr2,
> > artikelname, farbe, groesse, preis;
> > artnr|artnr1|artnr2|artikelname|farbe|groesse|sum|preis
> > -----+------+------+-----------+-----+-------+---+-----
> > | | | | | | |
> > (1 row)
try this:
xtra=> SELECT artnr, artnr1, artnr2, artikelname, farbe, groesse, SUM(menge),
xtra-> preis FROM warenkorb WHERE cookie = 'asdfasdf' GROUP BY artnr, artnr1,
xtra-> artnr2, artikelname, farbe, groesse, preis HAVING count(*)>0;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-12-17 17:09:24 Re: [SQL] select with group by problem
Previous Message kaiq 1999-12-17 15:26:13 Re: [SQL] select with group by problem