It's probably going to end up being something really dumb that I'm missing but I could use you guys' help on this one. FROM componentpsar WHERE tblid = '2' AND rownr = '1') UP' at line 1 I've been staring at it and searching the internet for a good half an hour and just can't find this supposed syntax error. It's just example data.:) Anyways, executing this query returns a syntax error: #1064 - 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 'IF EXISTS(SELECT. FROM componentpsar WHERE tblid = '2' AND rownr = '1') UPDATE componentpsar SET col1 = '1', col2 = '1', col3 = '1', col4 = '1', col5 = '1', col6 = '1', unit = '1', addinfo = '1', fsarlock = '1' WHERE tblid = '2' AND rownr = '1' ELSE INSERT INTO componentpsar (tblid, rownr, col1, col2, col3, col4, col5, col6, unit, addinfo, fsarlock) VALUES ('2', '1', '1', '1', '1', '1', '1', '1', '1', '1', 'N') Ignore the fact that I'm trying to set every column to '1'.
I have the following SQL query: IF EXISTS(SELECT.