SELECT
*
FROM
GFM_QUOTA_TASK_CONFIG
WHERE
1 = 1
AND config_id IN(
0,
20161212002,
20161212001,
20161212003,
20161212004,
20161212005,
20161212006,
20161212012,
20161212011
)
AND todo_state_id IS NULL
OR todo_state_id = 0
AND cur_flag NOT IN(0, 1);
SELECT
*
FROM
GFM_QUOTA_TASK_CONFIG
WHERE
1 = 1
AND config_id IN(
0,
20161212002,
20161212001,
20161212003,
20161212004,
20161212005,
20161212006,
20161212012,
20161212011
) AND(
todo_state_id IS NULL OR todo_state_id = 0
) AND cur_flag NOT IN(0, 1);
Or的优先级比较高,所以在拼sql的时候需要注意加上括号,否则查询结果会有很大出入