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

Need SQL to DELETE rows from table

Status
Not open for further replies.

btturner

Programmer
Joined
May 17, 2001
Messages
175
Location
US
Need help coding SQL delete statement ~

TABLE C O L U M N S
------- ----------------
TBL_A cA cB cC
TBL_B c1 c2 c3

Need to:

Delete all rows from TBL_A
where TBL_A.cA = TBL_B.c1
and TBL_A.cB = TBL_B.c2
and TBL_A.cC = TBL_B.c3

 
Delete A.* from TBL_A
where TBL_A.cA = TBL_B.c1
and TBL_A.cB = TBL_B.c2
and TBL_A.cC = TBL_B.c3


Leslie
 
sorry forgot there should be a join in there!




Leslie
 
I realize a JOIN is involved - can someone please provide the syntax? (
 
Is there a KEY field in either of these table somewhere?

And I was looking for the syntax after my last post.

Leslie
 
Maybe something like this:

DELETE FROM Table_A TA INNER JOIN Table_B TB ON TA.cA = T2.c1 AND T1.cB = T2.c2 and T1.cC = T2.c3
WHERE TA.cA = T2.c1 AND T1.cB = T2.c2 and T1.cC = T2.c3

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top