3 回答

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超3個(gè)贊
primary key
SET SQL_SAFE_UPDATES = 0;
primary key
where clause
).

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
去 Edit
-->Preferences
點(diǎn)擊 "SQL Editor"
標(biāo)簽和 uncheck
“安全更新” check box
Query
-->Reconnect to Server
/注銷,然后登錄 現(xiàn)在執(zhí)行SQL查詢。
不需要重新啟動(dòng)MySQL守護(hù)進(jìn)程!

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超3個(gè)贊
不需要將SQL_SAFE_UPDATE設(shè)置為0
UPDATE customers SET countryCode = 'USA' WHERE country = 'USA'; -- which gives the error, you just write:UPDATE customers SET countryCode = 'USA' WHERE (country = 'USA' AND customerNumber <> 0); -- Because customerNumber is a primary key you got no error 1175 any more.
添加回答
舉報(bào)