选择mysql组不工作

时间:2018-04-19 16:52:14

标签: mysql

我有一个选择mysql的问题,表是这样的:

id_type |  id_funz | state    
10           26        1
10           28        1
11           26        1  

我想选择id_type(with group by),他们(state_funz 26和28)在state = 1,实际上只有id_type = 10

为什么这不起作用?

SELECT *
FROM   table
WHERE
(id_funz = 26 AND state = 1) and ((id_funz= 28 AND state = 1)
group by id_type

非常感谢你

1 个答案:

答案 0 :(得分:0)

id_funz = 26id_funz = 28不能同时发生。将您的代码更改为:

(id_funz = 26 AND state = 1) OR (id_funz= 28 AND state = 1)