Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个设置数据范围的查询,但结果没有跟随查询,我可以设置一个没有问题的值,但是当我设置范围时它会抓取所有内容。范围在 2 到 50 之间,它提取 3000 的值。这里是代码:
SELECT SUM(datamb) AS tiera FROM maindata2 WHERE dataplan BETWEEN '2' AND '50' and email='email@email'
由于 2 和 50 在引号中,因此您暗示BETWEEN以字母数字方式计算。
BETWEEN
删除引号,如下所示:
SELECT SUM(datamb) AS tiera FROM maindata2 WHERE dataplan BETWEEN 2 AND 50 and email='email@email'
这可能是因为您试图获得两个字符串 '2' 和 '50' 之间的范围。您应该尝试使用BETWEEN 2 AND 50.
BETWEEN 2 AND 50