如何进行查询以删除 id 不是多个值的列?
我试过
DELETE FROM `Player` WHERE `Player`.`Squad` != 3,
4,
8,
9,
10,
11,
21,
31,
36,
43,
64,
65,
66,
71,
74,
103,
105,
154,
171,
190;
谢谢
如何进行查询以删除 id 不是多个值的列?
我试过
DELETE FROM `Player` WHERE `Player`.`Squad` != 3,
4,
8,
9,
10,
11,
21,
31,
36,
43,
64,
65,
66,
71,
74,
103,
105,
154,
171,
190;
谢谢
使用NOT IN
如下:
DELETE FROM Player WHERE Player.Squad NOT IN ( 3, 4, 8,9,10,11,21, 31,36,43,
64,65,66,71,74,103,105,154,171,190);
你可以试试
Delete from player where player.squad not in (3,4,8,9,10,...)
从小队不在的玩家中删除(3、4、8,9..........); http://dev.mysql.com/doc/refman/5.5/en//example-foreign-keys.html请参考 dz 链接了解更多信息
你可以使用NOT IN
DELETE FROM `Player` WHERE `Player`.`Squad` not in (3,4,8,...)
使用NOT IN
sql 不区分大小写,我们可以使用 smalls 或 caps 没问题。
DELETE FROM Player WHERE Squad NOT IN ( 3, 4, 8,9,10,11,21, 31,36,43,
64,65,66,71,74,103,105,154,171,190);