MySQL 小于或大于获取特定记录时不工作

问题描述 投票:0回答:0

我有一个如下所示的表格,其中有 5 条记录。我想获得金额小于 2000 的所有记录(绿色框)的其余部分。除了最后/最新的两条记录(红色框)。

enter image description here.

SELECT amount from invoice where invoiceDate LIKE '%2023-02-26%' AND (amount < 2000) ORDER BY invoiceId DESC LIMIT 2,6

当我尝试上面的查询时,它只返回一条记录 300 而不是预期的 300 和 850。为什么?

But it works when tried with (amount > 0) or (amount > 300) or (amount > 500) as expected, 
(amount > 0), returns 300 and 850 and 28500.
(amount > 300), returns 850 and 28500.
(amount > 500), returns 850 and 28500.
But again it doesn't work when applied (amount > 20000), it returns null instead of expected 20000. Why?
mysql phpmyadmin
© www.soinside.com 2019 - 2024. All rights reserved.