Re: Please help on SQL

From: Sanjay T. Mathew <alsm1_at_micro.lucent.com>
Date: 1998/03/25
Message-ID: <35197FCE.27901BD2_at_micro.lucent.com>#1/1


This is pretty easy try this;

Select a.cola , a.colb
From
(Select cola ,colb ,count(*)
 From foo
  Group By cola ,colb
  Having count(*) > 1) a
/

Hope this helps
Cheers
Sanjay T Mathew
Oracle DBA
Lucent Technologies

Shetal Sheth wrote: Hi Gurus,

> I am looking for the efficient way to construct SQL statement for following
> requirement, and I seem to be running out of ideas.
> following is the table and some sample data,
> Table foo : Column a Column b Column c Column d
> 111 222 0000 999
> 111 223 0000 4000
> 111 223 4001 5000
> 222 333 3333 4444
> 333 444 0000 3000
> 333 444 3001 5000
> Basically, I want to retrieve column A and Column B from all those records
> oftable foo where there is more than one entry for each column A and column B
> pair. Having said that the result of the mentioned query should return
> following data from the table foo.
> a b
> -- --
> 111 223
> 333 444
> Shetal Sheth
> sheths_at_bobcat.ent.ohiou.edu
Received on Wed Mar 25 1998 - 00:00:00 CET

Original text of this message