Re: What is wrong with this query?

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Tue, 12 Feb 2002 13:19:47 -0000
Message-ID: <3c69167a$0$238$ed9e5944_at_reading.news.pipex.net>


you need to add
GROUP BY OWNER_ID to your query.

--
Niall Litchfield
Oracle DBA
Audit Commission UK
*****************************************
Please include version and platform
and SQL where applicable
It makes life easier and increases the
likelihood of a good answer

******************************************
"Sergiu gp" <sergiugp_at_aol.com> wrote in message
news:20020212060201.10819.00001049_at_mb-ba.aol.com...

> Guys,
>
> I wonder why am I getting a not a single-group group function error with
this
> query:
>
> SELECT distinct owner_id ||' ' as "Owner ID", Count(distinct owner_id) as
> "Purch. Count", Sum(price) as "Purch. Count",
> avg(price) as "Avg. Purch."
> FROM purchase_tbl
> WHERE purchase_date BETWEEN
> TO_DATE('01-01-1998', 'mm-dd-yyyy') and
> TO_DATE('12-31-2000', 'mm-dd-yyyy')
>
> Do I have to use a nested query, and if yes, which column should I use for
the
> inner query?
Received on Tue Feb 12 2002 - 14:19:47 CET

Original text of this message