Re: [QUESTION] SQL*Plus: Joins

From: Javad Malik <javad_malik_at_dofasco.ca>
Date: 1996/10/23
Message-ID: <326E55CF.F07_at_dofasco.ca>#1/1


Javad Malik wrote :

One of the way is

select sum(decode(a.gender,'M',1,0)) male, sum(decode(a.gender,'F',1,0)) female, c from employee_table a;

varad acharya wrote:
>
> Frampton Steve R wrote:
> >
> > Hello:
> >
> > What is the proper way of doing something like this:
> >
> > select count(a.employee_id) male, count(b.employee_id) female
> > from employee_table a, employee_table b
> > where a.gender = 'M'
> > and b.gender = 'F';
> >
> > The statement as above return huge values that do not represent
> > actual counts. If the statement is broken up into two select
> > statements, the correct numbers are returned.
> >
>
> Try doing it this war
>
> select gender,count(*) from employee
> group by gender;
>
> --
>
> Regards,
>
> Varad Acharya
Received on Wed Oct 23 1996 - 00:00:00 CEST

Original text of this message