Re: Doubt in Group-By Query

Re: Doubt in Group-By Query

 

  

try this:

select to_char(date_col,'YYYY'), count(*) from some_table group by
rollup(to_char(date_col,'YYYY'));

the results wil be vertical, not horizontal, but it will provide the
toatl in the last row, and you won't need a-priori knowledge of the
possible date range.

Mike

Gururaj wrote:

>Hi,
>
>I have small doubt in Group By query.
>
>I want to display the total number of employees and, of that total, the number of employees hired in 1995,1996,1997 and 1998.
>
>i.e it should look like this..
>
>TOTAL 1995 1996 1997 1998
> 20 1 3 4 5
>
>Please help me asap.
>
>
>Thanks & Regards,
>
>Gururaj.C.M.
>Software Engineer,
>BLUE CHIP COMPUTER CONSULTANTS PRIVATE LTD.,
>Mobile No: +919845580082
>
>
>
>
>!-- Virus-Free Mail Using PostMaster Enterprise AvAc & QuickHeal Engine --!
>
>-------------------------------------------------------
>Bluechip Computer Consultants Pvt Ltd, Bangalore, India
>
>
>--------
>website: http://www.LazyDBA.com
>Please don't reply to RTFM questions
>Oracle documentation is here: http://tahiti.oracle.com
>To unsubscribe: see http://www.lazydba.com/unsubscribe.html
>To subscribe: see http://www.lazydba.com
>By using this list you agree to these terms:http://www.lazydba.com/legal.html
>
>
>
>
>

Oracle LazyDBA home page