表颜色:
id - color
1 - red
2 - blue
3 - black
表格标记:
color_id - mark
1 - fan
2 - lamp
1 - car
2 - switch
2 - house
查询:
SELECT c.* FROM colors c
LEFT JOIN marks m ON m.color_id = c.id
WHERE m.mark = 'fan' OR m.mark = 'switch'
GROUP BY c.id
预计会返回红色和蓝色的行,但这不会发生,为什么会这样?