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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete from table one using criteria of another table

Status
Not open for further replies.

Tock

MIS
Sep 18, 2003
1
US
I am trying to delete rows from table one when values equal values in table two. I cannot find an example. Can someone help?
 
DELETE TAB1
FROM TAB1 T1
INNER JOIN TAB2 T2
ON T1.Value = T2.Value

Thanks,
Pankaj
 
DELETE FROM TAB1 WHERE TAB1.Value IN (SELECT DISTINCT TAB2.Value FROM TAB2)

(Distinct is only good if Tab2 contains many rows but the given column is not very diversified)

Iker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top