Larry Brister
asked on
SQL Server delete statement
I have a database I inhetited
There is a UID in a table that gets copied into other tables on certain transactions.
I would like to know how I can delete from multiple tables where pmrID = # with one SQL statement
There is a UID in a table that gets copied into other tables on certain transactions.
I would like to know how I can delete from multiple tables where pmrID = # with one SQL statement
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
2 tables
----------
delete table1, table2 from table1, table2 where table1.pmrID = 123 and (table1.pmrID = table2.pmrID)
3 tables
----------
delete table1, table2, table3 from table1, table2, table3 where table1.pmrID = 123 and (table1.pmrID = table2.pmrID or table1.pmrID = table3.pmrID)
And so on...