帮帮我PLZ,这个sql无法正常工作
SELECT *
FROM p_pl
WHERE (`sid` = '25' AND `value` = 'zxc')
AND (`sшd` = '22' AND `value` = 'cxz')
这个sql workin:
SELECT * FROM p_pl WHERE (`sid` = '25' AND `value` = 'zxc')
如何进行查询?感谢
答案 0 :(得分:1)
也许你想要OR
?
SELECT *
FROM p_pl
WHERE (`sid` = '25' AND `value` = 'zxc')
OR (`sid` = '22' AND `value` = 'cxz')
答案 1 :(得分:1)
我认为你想使用OR
:
select *
from p_pl
where (`sid` = '25' and `value` = 'zxc')
or (`sid` = '22' and `value` = 'cxz')
或者简单地说:
select *
from p_pl
where (sid, value) in(('25','zxc'),('22','cxz'));
答案 2 :(得分:0)
你应该使用'OR'代替'AND'吗?
SELECT *
FROM p_pl
WHERE (`sid` = '25' AND `value` = 'zxc')
OR(`sшd` = '22' AND `value` = 'cxz')