I want to delete a data from multiple tables the data surely resides in the ad_master but sub table is vary from time to time. I tried following query but it at least doesn't delete a single record and keep silence. I want to delete every record associated with my given number($delete_no) if they exist on any of my given tables.
DELETE am,sub1,sub2,sub3
FROM ad_master am
INNER JOIN ad_vehicles sub1
ON sub1.Ad_no=am.Ad_no
INNER JOIN ad_properties sub2
ON sub2.Ad_no=am.Ad_no
INNER JOIN ad_electronics sub3
ON sub3.Ad_no=am.Ad_no
WHERE am.Ad_no=$delete_no
Please guide me to solve this. Thanx.