มายเอสคิวแอล ๘.๐๐ นิดๆ กับปัญหา DELETE ตอน safe mode

Mysql 4 ก.พ. 2021

เมื่อฉันรัน command delete แล้วทาง mysql แจ้งว่า

DELETE FROM items WHERE create_at BETWEEN '2021-01-28 00:00:00' AND '2021-01-28 23:59:59';

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.  To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

ให้แก้โดยการ ปิด safe mode แล้วค่อยเปิดขึ้นมาใหม่

SET SQL_SAFE_UPDATES = 0;
DELETE FROM items WHERE create_at BETWEEN '2021-01-28 00:00:00' AND '2021-01-28 23:59:59';
SET SQL_SAFE_UPDATES = 1;

แท็ก

Onyx

Just a middle-aged programmer, Can do many things but not the most.