How to delete related Data/Rows.
-
Ex: Tables: 1) Account: ID,UserName,Pass 2) Campaign: ID,AccountID,Date,Balance 3) CampaignSpec: ID,CampaignID,Spec,Color Note: Account.ID = Campaign.AccountID and Campaign.ID = CampaignSpec.CampaignID
-
Ex: Tables: 1) Account: ID,UserName,Pass 2) Campaign: ID,AccountID,Date,Balance 3) CampaignSpec: ID,CampaignID,Spec,Color Note: Account.ID = Campaign.AccountID and Campaign.ID = CampaignSpec.CampaignID
delete a, b, c
from Account as a inner join Campaign as b
on a.[id] = b.[id] inner join CampaignSpec as c
on b.[id] = c.campaignidand just include any where clause that you need else all will be deleted
Marc Clifton wrote:
That has nothing to do with VB. - Oh crap. I just defended VB!
-
delete a, b, c
from Account as a inner join Campaign as b
on a.[id] = b.[id] inner join CampaignSpec as c
on b.[id] = c.campaignidand just include any where clause that you need else all will be deleted
Marc Clifton wrote:
That has nothing to do with VB. - Oh crap. I just defended VB!
I would suggest the more "proper" way to do this would be to set up proper foreign key relationships along with cascade options in the database. Then you don't have to worry about this at all.