![](/img/trans.png)
[英]SQL server select oldest records where width column is within specific range of each other
[英]How to filter a specific record in SQL Server within in the date range without removing other records?
这是你想要的吗?
select t.*
from t
where name <> 'i' or
date2 <= dateadd(month, +6, date1 - datepart(month, date1) -1))
我不太确定你的情况应该是什么,但这就是你的问题。
根据文中的逻辑:
select t.*
from t
where name <> 'i' or
date2 <= dateadd(month, +6, date1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.