select * from matchdate
where (matchdate) = DATEADD(DAY, +2, getdate())
你想要一个不平等:
where matchdate >= convert(date, getdate()) and
matchdate < convert(date, DATEADD(DAY, +2, getdate()))
这假定您需要日历日。 如果您想要 48 小时:
where matchdate >= getdate() and
matchdate < DATEADD(hour, 48, getdate())
1st 您不应该在其中调用具有相同列名的表,下次尝试将T_matchdate作为表。 第二不等于但更大
select *
from (select * from matchdate)T_matchdate
where matchdate > DATEADD(DAY, +2, getdate())
and matchdate <= GetDate()
您可以尝试通过更SQL化的方式查找日期
select *
from (select * from matchdate) T_matchdate
where (matchdate) > sysdate
and matchdate < sysdate+2