Re: sub query

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Martin Kuria <martinkuria(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sub query
Date: 2003-09-20 15:38:59
Message-ID: Pine.LNX.4.44.0309201738250.2761-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Martin Kuria writes:

> Hi again I have this problem when I try to run this query, how can I rewrite
> it for it to work.
>
> SELECT o.item_order_num,SUM(o.item_quantity + o.item_product_id) As total,
> o.item_status
> FROM soko_product p, soko_ordered_item o
> WHERE p.product_id = o.item_product_id
> GROUP BY o.item_order_num
> ORDER BY o.item_order_num;
>
> Error: Attribute o.item_status must be GROUPED OR USE IN an aggregate
> function

Add o.item_status to the GROUP BY clause.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

  • sub query at 2003-09-20 13:40:13 from Martin Kuria

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-09-20 16:02:20 Re: Error with functions
Previous Message Christopher Browne 2003-09-20 14:00:19 Re: auto_increment