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
Comments
Post a Comment