Why don't you do a group by with a having clause
SELECT EmpID, count(B.UniqueID)
FROM EmpID tableA as A
JOIN TableB as B on A.empID = B.empID
GROUP BY EmpID
HAVING count(*) > 1
Thanks,
Neal
-----Original Message-----
From: Pillai Sreelatha
[mailto:mssqldba-ezmlmshield-x91371212.[Email address protected]
Sent: Friday, February 29, 2008 10:50 AM
To: LazyDBA Discussion
Subject: help with a sql
If i have tableA and tableB both of which are linked with employeeid
column how do i check to see for 1 record of an employee in tableaA
there are multiple records in tableB? Any help will be greatly
appreciated. TIA
For reln TableA.employeeid = TableB.employeeid
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
________________________________________________________________________
_____
Scanned by IBM Email Security Management Services powered by
MessageLabs. For more information please visit http://www.ers.ibm.com
________________________________________________________________________
_____
_____________________________________________________________________________
Scanned by IBM Email Security Management Services powered by MessageLabs. For more information please visit http://www.ers.ibm.com
_____________________________________________________________________________
MS Sql Server LazyDBA home page