Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get different columns total in one time query?
Take a look at the rollup and cube option on the group by.
Something like ...
Select f1,f2,count(*) from table group by cube(f1,f2);
or
Select f1,f2,f3,max(f4),count(*)
from table group by f1, f2, g3;
This last example is just to show you that you can (must) group by all columns in the select clause which are not part of a aggregate function, such as max or count, when you use the group by clause.
HTH Received on Wed Jun 08 2005 - 11:28:32 CDT