From: | Ludwig Meyerhoff <ludwig(at)antar(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | GROUP-BY |
Date: | 2001-10-04 23:19:26 |
Message-ID: | Pine.LNX.4.21.0110050119120.21298-100000@www.ludwig.antar.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hallo!
I have a small problem with Pg 7.1 ...
I have two tables, one with the items data like description and price, one
with the customers order, item-id and amount ...
Now, the order-table is in chronological order, so it can contain several
rows. The chronological order of the orders can be of interest when
dicussing with the customer, that list contains a timestamp also, disabled
for the moment.
Now, I was trying to find one query-string to get of a customer a list of
the items ordered, the respective number ordered and the total amount to
pay for them.
I tried something like:
select w.descr, k.number, (k.anzahl*w.price) as totprice from wares w,
customerware k where w.id=k.wareid group by w.descr;
I get an errormessage:
ERROR: Attribute k.number must be GROUPed or used in an aggregate function
The "Introduction and concepts" of Mr. Momjian did not help me much :(
Maybe someone here can help me?
Saluti!
Ludwig
From | Date | Subject | |
---|---|---|---|
Next Message | mathew morris | 2001-10-04 23:37:13 | Adding new enum value |
Previous Message | Ludwig Meyerhoff | 2001-10-04 23:13:55 | submit |