Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete multiple records based on data from another table 1

Status
Not open for further replies.

d1novak

Instructor
Jul 21, 2003
27
US
I have 2 tables tblCOMPANY and tblCOMPANY_ACCESS. TBL_COMPANY has COMPANYID and Sales_Division. tblCOMPANY_ACCESS has COMPANYID and USERID. I need to Delete all records in tblCOMPANY_ACCESS where tblCOMPANY.SALES_DIVISION='Enterprise' and TBL_COMPANY_ACL.USERID='1234'

I tried the following but all records were deleted. yikes!

DELETE FROM tblCOMPANY_ACCESS
WHERE EXISTS
(SELECT COMPANYID,'1234'
FROM tblCOMPANY
WHERE SALES_DIVISION='Enterprise')

any help is greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top