Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Group By
roy fells wrote:
> I have an element in my select statement (2 to be exact) that I don't want
> to group by but when I try to execute the query it says the element is not
> a group by expression. How do I make elements so that I can query without
> including them in a group by statement??
Columns returned by a query are eiter literals, or aggregated, or grouped by. I do not see any other possibility.
in
select a, sum(b), c from t where some_condition_holds group by a
what should be done with c? If you do not group by a and c and yield the sums of all different (a, c) pairs, there must be some rule what has to be done with two different values of c that occur in rows with the same value of a. If you just want any c, aggregate with min or max; if you know that c does not change when a changes, than putting c into the group by will not change the resulting groups.
Joachim Received on Wed Apr 25 2001 - 14:40:02 CDT