How to delete database row using joins..?

Dear All,

I want to delete some records from tabl1 which tabl1.id is not present in tabl2

any suggestion please…!

regards,
Darshan N

Should be so something like

DELETE FROM table1 WHERE table1.id NOT IN (SELECT table2.id from table2)

If you set up proper Foreign Keys you wouldn’t get in the situation to have to do this.

Sponsor our Newsletter | Privacy Policy | Terms of Service