Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: SUM and GROUP BY...

Re: SUM and GROUP BY...

From: Ole Christian <olecl_at_stud.idb.hist.no>
Date: Mon, 02 Apr 2001 11:35:39 +0200
Message-ID: <3AC847EB.421E5FE6@stud.idb.hist.no>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US