Delete From Multiple Tables

Copper Contributor

Hi, I'm learning SQL and I can't find on how to delete data from multiple tables, is there any way in doing this? I'm creating a stored procedure where I input the ID I wanted to delete in 2 tables, 1st table has unique ID and a column which references to the 2nd table.

 

Example:

table1

id | reference_code

1  | 123456

 

table2

reference_code

123456

 

 

I want to delete both entries on two tables just by calling the id from table 1

0 Replies