2
我遇到了SQLite問題,特別是我的日期問題。 如果我執行以下查詢:SQLite日期「大於其他日期」例如'25/09/2014'不起作用
SELECT g.Date FROM game w where g.date = "26/09/2014" order by timestamp desc
會給我
- 26/09/2014
- 26/09/2014
- 26/09/2014
但是,當我更改查詢項目=進入>,日期爲「25/09/2014」
SELECT distinct g.Date FROM gamew where g.date > "25/09/2014" order by timestamp desc
會給我的結果如下(我已經添加了 - 不同)
- 26/09/2014
- 31/08/2014
- 30/08/2014
- 29/08/2014
- 28/08/2014
- 27/08/2014
- 26/08/2014
- 31/07/2014
- 。 ..
哪些不是預期的結果:(因爲,只有一天是正確的。 也 我真的不喜歡改變數據庫,日期項目。我比較喜歡有給了我正確的基準回
例如數據庫
ID - Country - League - Team - Opponent - Location - Result - Scored - Against - Time - Date
--------------------------------------------------------------------------------
"20868","Spa","PRD","Celta_de_Vigo","Elche","A","1","1","0","1411758000","26/09/2014"
"47133","Ger","BUN","Hoffenheim","Mainz_05","A","x","0","0","1411756200","26/09/2014"
"59149","Ger","BUN","Mainz_05","Hoffenheim","H","x","0","0","1411756200","26/09/2014"
"25373","Spa","PRD","Cordoba","Valencia" ,"A","0","0","3","1411675200","25/09/2014"
... 11655 rows ...
編輯 類型g.Date的正確的查詢:
DATE DATE
SQLite沒有'date'數據類型,所以它比較字符串。在比較字符串時,'30/08/2014' **比'25/09/2014'大** – 2014-09-29 21:06:21