这是一种方法:
select b.blog_id
from blogs b
where (b.field = 'status' and b.data = '1') or
(b.field = 'categories' and b.data LIKE '%blog%')
group by b.blog_id
having count(*) = 2;
假定“状态”和“类别”仅出现一次。否则,您需要:
having count(distinct field) = 2
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句