`IF(@ParentField = 'Reason for call - Primary Issue')
BEGIN
DELETE FROM dbo.ControlBrandMapping CBM
INNER JOIN dbo.ControlManagement CM ON CM.ID = CBM.CONTROLID
WHERE CM.DefaultName = 'Reason for call - Sub Issue' AND CBM.BRANDID = @BrandId
END`
I tried my best to make it look as neat as possible.
I am getting this error – “Incorrect syntax near ‘CBM’.”
Please help
You are missing the alias
CBMafter theDELETEclause. Try this instead: