我需要过滤一个名为Departure的日期时间列。
我需要过滤器返回所有价格< = 100,并且出发日期在2105-03-14和2015-03-17之间,这些日期的出发时间是从下午1点开始。
我尝试了下面的代码。连接正常工作但where子句是问题。任何人都可以提供帮助。
Select Destination,Departure,Price
From PriceTable as p
Join Routes as r
On p.RouteID = r.ID
Join Destinations as d
On d.Airport_ICAO_Code = r.Airport_ICAO_Code
Where (Price <= 100) And (Departure between '2015-03-14' and '2015-03-17' >= '13:00:00')
Order by Price Asc
答案 0 :(得分:1)
这不是在xx:xx:xx
时间之后过滤记录的正确语法。试试这个where
条款
.....
.....
WHERE Price <= 100
AND Departure BETWEEN '2015-03-14' AND '2015-03-17'
AND CONVERT(TIME, Departure) >= '13:00:00'
.....