0

I have three tables.

  • Table 1 (table1_id, table1_name)
  • Table 2 (table2_id, table1_id, table2_name)
  • Table 3 (table3_id, table2_id, table3_name)

I want to delete all the information where table1_id = 33. How I also delete all table2 rows that have table1_id = 33 and also all table3 rows that have table2_id whose rows in Table 2 have table1_id = 33? What is the nicest and proper way to do that?

Valera P.
  • 47
  • 2
  • 10

1 Answers1

2

If you are using sql server then you can go for option "Cascade Delete". Use this option for Table1 and Table2 it should work.

How to use Cascade Delete

Community
  • 1
  • 1
Sagar Shirke
  • 648
  • 9
  • 32