我想查询数据库,以便我得到所有字段,其中field = x,所有字段where = y,只有一个字段,其中field = z仅一个查询,所以我可以得到这样的东西:
(...)content = something,field = x
(...)content = something,field = x
(...)content = something,field = x
(...)content = something,field = x
(...)content = something,field = y
(...)content = something,field = y
(...)content = something,field = z(只有一个字段,其中field = Z)
我尝试使用不同但它不会起作用。对这一个有什么想法吗?非常感谢你!
答案 0 :(得分:1)
(select * from your_table where field in ('x', 'y'))
union all
(select * from your_table where field = 'z' limit 1)