在我的查询中,我想用OR编写带有And操作的逻辑。但我的查询不起作用。
(ax bx + ay by) / (ax by - ay bx)
我认为
select *
from `data`
where `city`='mycity'
AND performDate='4'
and (curtime() >= `valid_from` OR curtime() <= `valid_to`)
and perform_type='ptype'
这种逻辑不起作用
答案 0 :(得分:0)
UNTESTED ---
$time = curtime();
SELECT * FROM data WHERE city = 'mycity' AND performDate = '4' AND perform_type = 'ptype' AND ($time >= 'valid_from' OR $time <= 'valid to');
答案 1 :(得分:0)
将每个 OR 更改为 AND
select *
from `data`
where `city`='mycity'
AND performDate='4'
and (curtime() >= `valid_from` AND curtime() <= `valid_to`)
and perform_type='ptype'