Re: What is wrong with this query?
Date: 12 Feb 2002 08:54:07 -0800
Message-ID: <ab87195e.0202120854.34c481d8_at_posting.google.com>
Try
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') GROUP BY owner_id;
m
sergiugp_at_aol.com (Sergiu gp) 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 - 17:54:07 CET