1

我们有 3 个特定的列 orderTotalFrom 和 orderTotalTo 和 ShippingPrice。我们正在尝试确定价格是否介于 2 列值之间。例如,假设我们有一个 250.0000 的订单,我们希望返回运费为 0.0000 的行

orderTotalFrom orderTotalTo   ShippingPrice
0.0000         19.9900        6.9500
20.0000        39.9900        7.9500
40.0000        59.9900        8.9500
60.0000        74.9900        9.9500
75.0000        999999.0000    0.0000

请告诉我这是如何在 MySql 中完成的?

4

5 回答 5

6
select ShippingPrice 
from MyTable
where 250.0000 between orderTotalFrom and orderTotalTo 
于 2012-07-10T14:13:10.110 回答
3
SELECT ShippingPrice FROM myTable WHERE 250 BETWEEN orderTotalFrom AND orderTotalTo
于 2012-07-10T14:13:31.677 回答
3
SELECT * FROM table WHERE  250000 between orderTotalFrom and orderTotalTo 
于 2012-07-10T14:13:38.787 回答
3
select ShippingPrice
from your_table
where orderTotalFrom <= 250.0000
and orderTotalTo >= 250.0000
于 2012-07-10T14:13:59.933 回答
1
SELECT ShippingPrice FROM table WHERE orderTotalFrom<=xxx AND orderTotalTo>=xxx;
于 2012-07-10T14:13:16.537 回答