Code:
INSERT INTO `blogTags` (`parentID`, `tagID`) VALUES('3', '2') WHERE NOT EXISTS (SELECT * FROM `blogTags` WHERE `parentID` = '3' AND `tagID` = '2' )
Working on this query here it should add in a new record into blogTags if the parentID and tagID(compound key) do not already exist. However it returns the following error.
Exception code: 1064
Exception message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT * FROM `blogTags`
WHERE `parentID` = '3' AND' at line 3