Say I have two tables of this format:
table1:
index,
field1,
data,
table2:
field1,
field2,
Each row in table1 has a row in table2 where field1 of table2 is equal to field1 in table1.
How do I go about deleting every entry in table1 where the index field is of NN value, but also delete the corresponding entries in table2?
I tried googling delete on cascade as I used that way back, but all I"m getting is people saying to add that when defining the table. This is not a table I have defined, I need to do it on the fly during the delete statement. Is there perhaps a way with sub queries I could do it?
table1:
index,
field1,
data,
table2:
field1,
field2,
Each row in table1 has a row in table2 where field1 of table2 is equal to field1 in table1.
How do I go about deleting every entry in table1 where the index field is of NN value, but also delete the corresponding entries in table2?
I tried googling delete on cascade as I used that way back, but all I"m getting is people saying to add that when defining the table. This is not a table I have defined, I need to do it on the fly during the delete statement. Is there perhaps a way with sub queries I could do it?
