RE: help with a sql

RE: help with a sql

 

  

You are making the assumption that Employeeid is a primary key or other
unique index of tableA. I don't not believe this will work otherwise.

-----Original Message-----
From: Jerry Sparling
[mailto:mssqldba-ezmlmshield-x5935486.[Email address protected]
Sent: Friday, February 29, 2008 12:05 PM
To: LazyDBA Discussion
Subject: RE: help with a sql

Would this do it?

Select tableb.employeeId, count(*)
From tableA a,
tableB b
Where a.employeeId = b.employeeId
Group by b.employeeId
Having count(*) > 1

-----Original Message-----
From: Pillai Sreelatha
[mailto:mssqldba-ezmlmshield-x91371212.[Email address protected]
Sent: Friday, February 29, 2008 8: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




---------------------------------------------------------------------
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




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.1/1303 - Release Date: 2/28/2008
12:14 PM



MS Sql Server LazyDBA home page