我正在尝试查询他们的球队在15,9,25,26,23,18,12和null。问题是查询没有检索到NULL记录。
我尝试使用OR team IS NULL
查询为我提供了所有其他状态。
SELECT e.*,
FROM enquiries e
WHERE e.timestamp BETWEEN '1293840000' AND '1469055599'
AND e.status IN(1) AND e.team IN(15, 9, 25, 26, 23, 18, 12, NULL)
ORDER BY e.timestamp ASC
请帮助
答案 0 :(得分:1)
将OR条件放在括号中
SELECT e.*,
FROM enquiries e
WHERE e.timestamp BETWEEN '1293840000' AND '1469055599'
AND e.status IN(1) AND ( e.team IN (15, 9, 25, 26, 23, 18, 12) OR e.team IS NULL)
ORDER BY e.timestamp ASC