我基於列ID和日期有數據......數據類型,日期爲DATETIME
數據庫:SQL Server 2008中
查詢1 :
Select *
from table t1
where (t1.date between '2016-05-11' and '2016-05-13')
問題2:
select *
from table t1
where t1.date IN ('2016-05-11')
結果是NULL即使我有在這個日期的記錄
那麼,有任何替代獲取記錄除了(< =/</>/> =)更大的比或小於
請用select * from t1表,其中 '2016年5月13日' '2016年5月11日' 之間(t1.date和) –
參考http://stackoverflow.com/questions/10643379/how-do-i-query-for-all-dates-greater-than-a-certain-date-in-sql-server – wajeeh
@ChetanSanghani您的查詢是查詢1,我沒有得到任何記錄 –