-3

我正在尝试删除关注者少于 10 且关注者超过 1000 的用户的所有数据。到目前为止,我得到了这个查询:

DELETE FROM Test 
WHERE Followers 
BETWEEN 1 AND 9 

此查询删除关注者不足 10 人的用户的数据。如何删除关注者超过 1000 人的用户?我可以将两个查询合二为一吗?

4

4 回答 4

7

问题是你没有DELETE *这意味着你必须告诉它哪一列DELETE来自一行。但是,您正在删除整行,因此不必指定*

DELETE FROM Test 
WHERE (Followers >=1 
AND Followers <10)
OR Followers >1000
于 2014-03-14T12:24:02.490 回答
4

尝试这个:

由于Followers字段仅包含 > 0 的值:

DELETE FROM Test 
WHERE Followers <10 
OR Followers >1000
于 2014-03-14T12:21:56.437 回答
2

Add this second condition to your query with OR

DELETE
  FROM Test 
 WHERE Followers BETWEEN 1 AND 9
       OR Followers > 1000;
于 2014-03-14T12:22:12.453 回答
2

Simply combine the conditions with an OR clause:

DELETE
FROM        Test 
WHERE       Followers BETWEEN 1 AND 9
    OR      Followers >1000
于 2014-03-14T12:23:16.017 回答