我在 MySQL 中的 select 语句有问题。
我有两个陈述只是略有不同,第一个似乎有效,但第二个无效。第二条语句返回 0 个结果。我错过了什么/做错了什么?
设置变量
SET @maxOK = 1.2;
SET @minOK = .8;
1# 之间没有
SELECT *, fee - (receipts * -1) AS difference
FROM div.Data1
WHERE (receipts * -1) NOT BETWEEN (fee * @minOK) AND (fee * @maxOkay);
2#之间
SELECT *, fee - (receipts * -1) AS difference,
receipts * -1 as rec,
fee * @minOk as min, fee * @maxOk as max
FROM div.Data1
WHERE (receipts * -1) BETWEEN (fee * @minOK) AND (fee * @maxOkay);
一些应该显示为两个但没有显示的数据
SELECT *, fee - (receipts * -1) AS difference,
receipts * -1 as rec,
fee * @minOk as min, fee * @maxOk as max
FROM div.Data1