我想要检索范围2200000(min_price
)到2700000(max_price
)
查询应该看起来像
SELECT *
FROM properties
WHERE ( ((raw_min >= '{$min_price}')
OR (raw_min <= '{$max_price}'))
AND ((raw_max >= '{$min_price}')
OR (raw_max <= '{$max_price}')))
AND (..)
查询应满足以下6个条件
raw_min - raw_max
(1) 1000000-2000000 (false)
(2) 1500000- 2400000 (true)
(3) 2300000-2600000 (true)
(4) 2500000-3000000 (true)
(5) 3200000-5000000 (false)
(6) 2000000-3000000 (true)
答案 0 :(得分:1)
请尝试此查询: -
SELECT *
FROM properties
WHERE (raw_min between 2200000 AND 2700000)
OR (raw_max between between 2200000 AND 2700000)
OR (raw_min <= 2200000 && raw_max >= 2700000)
请检查我是否更新了查询。