sql - Delete with inner join across 3 tables -
i have 3 tables 1 of storing users basic information, other 1 profile information , last 1 storing user picture.
when deleting these user need delete of data in these tables. write query this.
delete kullanicilar kullanicilar inner join profilbilgileri on kullanicilar.id = profilbilgileri.uyeid inner join uyeresim on kullanicilar.id = uyeresim.uyeid kullanicilar.id=@id
but deleting data "kullanicilar" table.
suggestions?
edit : i'm using mssql 2008 hosting firm 2000 need compatible code.
you can use trigger xavinou sugested or, if have foreign keys in tables, can go delete on cascade option. foreign keys created using this:
foreign key ([id]) references anothertable on delete cascade
Comments
Post a Comment