2011-03-06 45 views
1

如果日期列處於DATE數據類型,則查詢從表中獲取記錄,對於特定日期則爲查詢。Iam在DB2中工作。 如果我在03/06/2011(mm/dd/YYYY)給出數據格式如果日期列處於日期數據類型,則查詢從表中獲取記錄的日期列

ex: 選擇* from table customer where date =「03/06/2011」is not working。日期列是DATE數據類型。

+0

請更具描述性,展示您迄今爲止所嘗試的內容,並解釋您卡住的位置。 – Mat

回答

1

將雙引號改爲單引號,也許?

Select * from table customer where date = '03/06/2011' 

另外,使用ISO格式指定日期值可能會更可靠:

Select * from table customer where date = '2011-03-06' 
0

我想你需要你的字符串日期轉換爲實際的日期,就像這樣:

Select * from table customer where date = DATE('03/06/2011'); 
相關問題