Node.js mysql Syntax Error in Merge Statement? -


i have sql query constructed follows:

tmpquery = "insert vertix_users (user_name, user_email, user_pass) " +     "values (" + mysql.escape(username) +     ", " + mysql.escape(useremail) +      ", " + mysql.escape(userpass) + ")";  tmpquery = "merge vertix_users (holdlock) olddata " +     "using (values (@user_name, @user_email)) newdata (" + mysql.escape(username) + ", " + mysql.escape(useremail) + ") " +     "on newdata.user_name = olddata.user_name , newdata.user_email = olddata.user_email " +     "when not matched target " + tmpquery; 

when execute code, following log:

merge vertix_users (holdlock) olddata using (values (@user_name, @user_email)) newdata ('asfasfsaff vvv', 'asfasfasfasf') on newdata.user_name = olddata.user_name , newdata.user_email = olddata.user_email when not matched target insert vertix_users (user_name, user_email, user_pass) values ('asfasfsaff vvv', 'asfasfasfasf', 'saqqq') 

and sql syntax error reads:

you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'merge vertix_users (holdlock) olddata using (values (@user_name, @user_e' @ line 1] 

a simple insert statement without merge works fine, add second portion of code, creates error.

merge not supported mysql, equivalent

insert ... on duplicate key update


Comments

Popular posts from this blog

javascript - Hide toolbar of pdf file opened inside iframe using firefox -

Ansible - ERROR! the field 'hosts' is required but was not set -

Copy range with conditional formatting -