0
有沒有辦法在UPDATE中完成MySQL中的單個表掃描? 下面是一個標準的例子:MySQL單表掃描更新
IF EXISTS (SELECT * FROM Table1 WHERE Column1='SomeValue')
UPDATE Table1 SET (...) WHERE Column1='SomeValue'
ELSE
INSERT INTO Table1 VALUES (...)
這是最理想的情況,我想在MySQL中發生(不過這是MSSQL):
UPDATE user SET (name = 'jesse') WHERE userid ='10001'
IF @@ROWCOUNT=0
INSERT INTO user (name) VALUES('jeeeeee')