If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Selecting duplicates only

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-07, 08:46
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Selecting duplicates only

I have tables as below

Employees(EmployeeNum, Department, Division ... )
Appr(UniqueID, EmployeeNum, ApprDate, ApprType ... )

Where one employee can have many records in the Appr table.
Basically, what I want is to pick out employees who have multiple records in the Appr table.

Is this at all possible?
Please ask any questions needed!

- GeorgeV
__________________
George
Twitter | Blog
Reply With Quote
  #2 (permalink)  
Old 02-11-07, 15:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Code:
select EmployeeNum
     , Department
     , Division
  from Employees 
 where EmployeeNum in
       ( select EmployeeNum
           from Appr
         group
             by EmployeeNum
         having count(*) > 1 )
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 02-14-07, 09:18
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Perfecto! <3
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On