Syntax error on MERGE statement

MERGE is not supported by MySQL, The equivalent for that is

INSERT … ON DUPLICATE KEY UPDATE

Try this,

INSERT INTO tableName (email, secret, passwd, ts, newAcct) 
VALUES ($1,$2,$3,$4,TRUE)
ON DUPLICATE KEY UPDATE newAcct=TRUE, existingUser=NULL, secret=$2, ts=$4

but be sure email is set as Primary Key or Unique.

Leave a Comment