如图,我想查询CompanySourceId(外键)为空的时候,CompanySourceName也为空;
CompanySourceName是从另外一个表读的!现在查询的表是company

解决方案 »

  1.   

    最好给出完整的表结构,测试数据,计算方法和正确结果.否则耽搁的是你宝贵的时间。
    如果有多表,表之间如何关联?
    发帖注意事项
    http://topic.csdn.net/u/20091130/21/fb718680-98ff-4afb-98d8-cff2f8293ed5.html?24281
      

  2.   

    where a.CompanySourceId is null and b.CompanySourceName is null
      

  3.   

    A表 B表; 
    A表里面有B表的外键,查询A表的时候要查到B表的name 就这么回事!!
      

  4.   


    select a.*,b.[name]
    from a,b
    where a.id = b.id
      

  5.   

    A表中的BID为空的时候,让name也为空!
      

  6.   

    你这样的话,空的BID,就查不到了!
      

  7.   

      BID为空的话,A表的数据就没有; 我就想BID为空  会有数据,让name为空! 
      

  8.   


    select a.*,b.[name]
    from a left join b on a.id = b.id