您好我正在寻找能够获得两个日期之间记录的查询
开始日期应为OrderDate
+ 28天
结束日期应为开始日期+ 4天的结果
选择查询
SELECT dbo.Orders.*, dbo.Customer.* FROM dbo.Orders INNER JOIN dbo.Customer ON dbo.Orders.Cust_ID = dbo.Customer.Cust_ID
答案 0 :(得分:2)
使用DATEADD()资金
SELECT dbo.Orders.*, dbo.Customer.*
FROM dbo.Orders INNER JOIN dbo.Customer ON dbo.Orders.Cust_ID = dbo.Customer.Cust_ID
WHERE [Start-date] DATEADD(day,28,OrderDate) AND [End-date] = DATEADD(day,4,[Start-date])