Re: Group by and order by
the GROUP BY clause does not contain all the expressions in the SELECT clause.
Re: Group by and order by
Hi Brijesh,
To use a Group BY clause, you would need to have atleast one aggregate function in the Select Clause.
Aggregate function like Count(*), Sum, Avg etc.
All other columns excepting the one with the Aggregate function, would need to be part of the GroupBy clause.
[U]Example.[/U]
Select METHOD_NAME, Count(*), ROUND(AVG(LAST_CALL_DURATION)/1000,3), SERVICE_NAME, RESPONSE_STATUS
From SGC.GATE_QUEUE
where SYSTEM_NAME in ('CCTOOL', 'FALLOUT_HANDLING_TOOL') -- application of interest
and date_modified >= to_date('10/03/2007 06:24 AM', 'MM/DD/YYYY HH:MI AM')
and date_modified <= to_date('10/03/2007 07:45 AM', 'MM/DD/YYYY HH:MI AM')
and METHOD_NAME = 'getPort25'
Group By SERVICE_NAME, METHOD_NAME, RESPONSE_STATUS
Cheers...
Re: Group by and order by
Hi,
In Group by clause, its dont accept the text datatype. Pls chk whether ur one of the column may be a text.
Thx
Prakash
Re: Group by and order by
[QUOTE=bizzzzzare;24585]Hi Brijesh,
To use a Group BY clause, you would need to have atleast one aggregate function in the Select Clause.
Aggregate function like Count(*), Sum, Avg etc.
Cheers...[/QUOTE]
Thanks bizzzzzare,
I got my answer.It's not required to use a Group BY clause, you would need to have atleast one aggregate function in the Select Clause.
But the case is that, the column name which you are using in select should be either in group by statement or in aggregate function.:)