看板 Database 關於我們 聯絡資訊
資料庫名稱:postgresql 資料庫版本:8.4 內容/問題描述: 小弟有個table,欄位屬性是是text,存的資料是日期且有部分欄位是有空值的, 存的格式 如下 2018/1/2 2018/12/1 2018/10/2 用 select * from table where date(date) between date(2018/1/1) and date(2018/2/1) 會出現error 欄位有空值的錯誤,想說用 select * from table where (date(date) between date(2018/1/1) and date(2018/2/1)) and date !='' 會出現一樣的問題,看來關念有誤 麻煩各位高手指點,感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.169.8.57 ※ 文章網址: https://www.ptt.cc/bbs/Database/M.1515670054.A.AA5.html
wei10cool: is not null 01/12 00:50
billy522: 或是 and coalesce(date,'') != '' 01/12 07:36
joedenkidd: 感謝 is not null 之前試過不行,剛試ㄌ coalesce可以 01/13 13:37