Having a problem with this query, anyone know the problem?
INSERT INTO options
(grouptogether)
VALUES
('0')
WHERE userid = '2' ON DUPLICATE KEY UPDATE grouptogether = '0';
INSERT INTO options
(grouptogether)
VALUES
('0')
ON DUPLICATE KEY UPDATE grouptogether = '0'
WHERE userid = '2';
I tried both combinations of moving the where clause, but that doesn’t seem to do it.
INSERTqueries do not haveWHEREclauses. In anINSERT INTO...ON DUPLICATE KEY UPDATEquery the row which gets updated is the row in which there was a key collision; you do not need to specify the row by aWHEREclause.You probably meant to do something like this: