View previous topic :: View next topic |
Author |
Message |
Catherine Beginner
Joined: 30 Aug 2006 Posts: 32 Topics: 15 Location: Chennai
|
Posted: Thu Sep 21, 2006 4:30 am Post subject: Retrieving Duplicates |
|
|
Hi,
Here is the data. I need to generate rows which have duplicates for the coloumn DEPT
NAME DEPT POST
AAA D1 123
BBB D1 456
CCC D2 789
DDD D3 234
EEE D4 567
FFF D5 890
GGG D5 112
My o/p should be as shown
NAME DEPT POST
AAA D1 123
BBB D1 456
FFF D5 890
GGG D5 112
Can anybody help me generating an SQL query?
[/code] |
|
Back to top |
|
|
sureshmbt Beginner
Joined: 17 Aug 2006 Posts: 4 Topics: 3
|
Posted: Thu Sep 21, 2006 5:49 am Post subject: |
|
|
Code: |
select *
from employ
where dept_id in (select dept_id from employ group by dept_id having count(*) > 1)
|
|
|
Back to top |
|
|
|
|