MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Retrieving Duplicates

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Catherine
Beginner


Joined: 30 Aug 2006
Posts: 32
Topics: 15
Location: Chennai

PostPosted: Thu Sep 21, 2006 4:30 am    Post subject: Retrieving Duplicates Reply with quote

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
View user's profile Send private message
sureshmbt
Beginner


Joined: 17 Aug 2006
Posts: 4
Topics: 3

PostPosted: Thu Sep 21, 2006 5:49 am    Post subject: Reply with quote

Code:

select  *
  from employ
 where dept_id in (select dept_id from employ group by dept_id having count(*) > 1)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group