0

如何进行查询以删除 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;

谢谢

4

5 回答 5

2

使用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);
于 2012-11-07T06:21:58.450 回答
2

你可以试试

Delete from player where player.squad not in (3,4,8,9,10,...)
于 2012-11-07T06:22:18.540 回答
2

从小队不在的玩家中删除(3、4、8,9..........); http://dev.mysql.com/doc/refman/5.5/en//example-foreign-keys.html请参考 dz 链接了解更多信息

于 2012-11-07T06:33:59.620 回答
1

你可以使用NOT IN

DELETE FROM `Player` WHERE `Player`.`Squad` not in (3,4,8,...)
于 2012-11-07T06:21:55.000 回答
0

使用NOT INsql 不区分大小写,我们可以使用 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);
于 2012-11-07T06:30:41.980 回答