我 Sql server 我使用这个命令来插入值,如果 id 已经存在,则更新 vale
string commandLine = "IF NOT EXISTS(SELECT clientid FROM Rating WHERE clientid = " + clientId + " AND userid = " + userid + ") " +
"INSERT INTO Rating VALUES(@clientId,@userid,@rating) " +
"ELSE " +
"UPDATE Rating SET rating=@rating WHERE clientid = " + clientId + " AND userid = " + userid + ";";
我现在移动到MySQL
这个命令将不起作用。MySQL有什么相同的吗?