mysql NULL value in where in CLAUSE

前端 未结 4 1427
挽巷
挽巷 2021-01-04 04:59

how to deal with NULL value in mysql where in CLAUSE

i try like

SELECT * FROM mytable WHERE field IN(1,2,3,NULL)
<         


        
4条回答
  •  生来不讨喜
    2021-01-04 05:30

    Following statement should help:

    SELECT * FROM mytable WHERE COALESCE(field,0) IN (1,2,3,0)
    

提交回复
热议问题