我假设这将在查询的where部分完成,但我不确定如何为查询创建动态部分。
发布于 2015-10-16 23:11:55
对于TSQL,您希望使用DATEADD()函数。
SELECT * FROM table WHERE datecol >= DATEADD(month, -3, getdate()) AND datecol <= DATEADD(day, -1, getdate())
截断getdate()将根据需要将您带到午夜。
https://stackoverflow.com/questions/33045380
复制相似问题