select a.mobile 
  from @mobile a left join 
你这里是外连到@mobile这里,也是就先满足@mobile表,那么select * from [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder where feetype <>0是没有一条数据的,没有数据也是正常的.

解决方案 »

  1.   

    因为你用的left join
    而且是on的多个条件,找不到对应记录都为null
      

  2.   


    楼主用的左连接@mobile a left join [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder b 只要@mobile有数据,存储过程就有数据
      

  3.   

    我现在的这个存储过程就是想把 [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder  feetype<>0的mobile 查出来该怎么做
      

  4.   

    但是select * from [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder where feetype <>0是没有一条数据的不是说没有数据吗?那咋查啊?
      

  5.   

    select * from [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder where feetype =0 是有数据
    我现在执行这个存储过程返回的mobile 就是feetype =0的数据,我想要的结果是feetype <>0的数据  select * from [172.16.1.245].[jxtshare].dbo.Jxt_mobileorder where feetype <>0没有数据,那么执行这个存储过程返回的值也应该为空阿。这个应该怎么做
      

  6.   

    楼主得注意条件的方法select * from a left join b on a.col1=b.col1 and b.col2=5select * from a left join b on a.col1=b.col1 where b.col2=5这2个是不一样的
      

  7.   

    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,@seldate)=1 and b.feetype <>0
    order by a.mobile desc 这样就可以了