有关语句有错..
select ch,gname,cx,lxr,lxrtel,logdate,cyear from tbxlclzl
where datediff(month,logdate,getdate()+5)%6=0
and
case when month(dateadd(month,datediff(month,logdate,getdate()+5),logdate)+5)>
month(dateadd(month,datediff(month,logdate,getdate()+5),logdate))
then
datediff(day,getdate()+5,dateadd(month,datediff(month,logdate,getdate()+5),logdate))
between -5
and 0
else
datediff(day,getdate(),dateadd(month,datediff(month,logdate,getdate()+5),logdate))
between 0
and 5
end
and color='货车'
and awycens = 1
提示between附近有错,但是我把between上面的datediff(day,getdate()+5,dateadd(month,datediff(month,logdate,getdate()+5),logdate))
放到select随便找条件查询都能得出一个数值,为什么between的时候就不行呢..求解