Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 delete query based ids join table1 and table2

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2011-02-12 : 07:07:20
i want to delete all rows in table1 that has id match from table2.
Joining table1.id = table2.id

Is this the rightway to delete?

delete from table1 t1 join table2 t2 on t1.id = t2.id


thank you very uch for the helpful info.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-02-12 : 07:26:07
delete t1 from table1 t1 join table2 t2 on t1.id = t2.id


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -