Try:from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and b.feetype <>0 --->from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and isnull(b.feetype,1) <>0 or:from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and (b.feetype <>0 or b.feetype is null )
where datediff(mm,b.feetime,'2008-05-01')=1 and b.feetype <>0 --->from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and isnull(b.feetype,1) <>0 or:from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and (b.feetype <>0 or b.feetype is null )
--将 b.feetype <>0 改成(b.feetype <>0 or b.feetype is null )另外弱弱的问下。
select a.mobile
from @mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b on a.mobile=b.mobile
where datediff(mm,b.feetime,'2008-05-01')=1 and b.feetype=0
order by a.mobile desc楼主这样真的能查出结果来么?表名用变量。而不用动态SQL。也不报错。强。。
where isnull(datediff(mm,b.feetime,'2008-05-01'),0)<>1 or --这里应该<>1 or ,而不是=1 and
isnull(b.feetype,1) <>0