GROUP-BY
От | Ludwig Meyerhoff |
---|---|
Тема | GROUP-BY |
Дата | |
Msg-id | Pine.LNX.4.21.0110050119120.21298-100000@www.ludwig.antar.com обсуждение исходный текст |
Список | 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
В списке pgsql-general по дате отправления: