tnonline
30-09-2003, 07:31
Dear guys,
How to DELETE a row from 2 tables?
For one table, I can use SQL statement like this:
sql = "DELETE FROM Table1 WHERE Field1 = 'abc'"
Now I have 2 tables:
Table 1: includes 1 Primary Key and a Foreign Key (used to link to Table 2), and some other fields;
Table 2: includes a Primary Key (link to Table 1) and some other fields.
I want to DELETE a row from Table 1 based on Primary Key, and the coresponding row in Table 2 based on Foreign Key.
Any body know how to write a SQL statement for this? Please help me.
Thank a lot.
How to DELETE a row from 2 tables?
For one table, I can use SQL statement like this:
sql = "DELETE FROM Table1 WHERE Field1 = 'abc'"
Now I have 2 tables:
Table 1: includes 1 Primary Key and a Foreign Key (used to link to Table 2), and some other fields;
Table 2: includes a Primary Key (link to Table 1) and some other fields.
I want to DELETE a row from Table 1 based on Primary Key, and the coresponding row in Table 2 based on Foreign Key.
Any body know how to write a SQL statement for this? Please help me.
Thank a lot.