Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SUM and GROUP BY...
TurkBear wrote:
> You are grouping by a field that is not in your output, but the grouping
> remains..that is why it appears to be doubled - it is one sum for each
> field_name,date_field combination value;
>
> Try,
> select field_name, sum(numbers) as numbers
> from topten
> group by field_name
> where months_between(sysdate,date_field)<1
> order by numbers desc;
Well, I've tried that that Turkbear. But then the date_field is "not a GROUP BY function". Which means I cannot use it in the line : where months_between(sysdate,date_field)<1
Any other suggestions?
Ole C. Received on Mon Apr 02 2001 - 04:35:39 CDT