SQL时间段的查询的两种执行方法

SELECT     KS_Date, KS_MetalName, KS_TopLimit, KS_BottomLimit, KS_Average, KS_Change
FROM KS_U_SpotPrice
WHERE (KS_Date BETWEEN CONVERT(datetime, '2011-12-14') AND CONVERT(datetime, '2011-12-20'))

等效于下面的查询代码:

SELECT     KS_Date, KS_MetalName, KS_TopLimit, KS_BottomLimit, KS_Average, KS_Change
FROM KS_U_SpotPrice
WHERE (KS_Date <= CONVERT(datetime, '2011 - 12 - 20')) AND (KS_Date >= CONVERT(datetime, '2011 - 12 - 14'))



posted @ 2011-12-19 08:55  James·wang  阅读(488)  评论(0编辑  收藏  举报