Re: [QUESTION] SQL*Plus: Joins

From: Tony Downs <tdowns_at_mail.win.org>
Date: 1996/10/12
Message-ID: <01bbb7eb$b0e4c1c0$1f32b8cc_at_tdowns.win.org>#1/1


You should execute something like this:

select gender,count(*)
from employee_table
group by gender

What you were executing was something like a cartesian join. If you have a 1,000 record table, you joined each record with every other record. You would have a 1,000,000 record intermediate file (well... maybe not with your join criteria), but it's not what your looking for. The above statement will return two records, unless you have some unexpected values in your gender column.

Terry Brandt <tbrandt_at_netins.net> wrote in article <325E6393.2EB3_at_netins.net>...

> 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';
> >
Received on Sat Oct 12 1996 - 00:00:00 CEST

Original text of this message