select t1.f1,t2.f2 
from t1 left join t2 
where t1.f0=@value and t1.f0=t2.fx
或select t1.f1,t2.f2 
from t1 right join t2 
where t1.f0=@value and t1.f0=t2.fx

解决方案 »

  1.   

    select a.f1,b.f2 
    from t1 a left join t2  b
    on a.f0=@value and a.f0=b.fx
      

  2.   

    如果看到null不顺眼,用isnull()函数处理
      

  3.   

    您的回复似乎接近了
     但是出来的结果并不符合a.f0=@value 的条件,而是把整个t2 b都列出来了,不管是不是空
      

  4.   

    谢谢您 可以了 是
    select a.f1,b.f2 
    from t1 a left join t2  b
    on a.f0=b.fx
    where  a.f0=@value