用户连接可以,下面不知对不对,这样类似
select table1.bh,table1.dj,table1.sl
from table1
left join (
select table2.name from table2 
) on table1.bh=table2.bh

解决方案 »

  1.   


    select table1.bh,table1.dj,table1.sl
    from table1
    left join (
    select table2.name from table2 
    ) table2 on table1.bh=table2.bh
      

  2.   

    select table1.bh,table2.name,table1.dj,table1.sl
    from table1,table2
    where table1.bh=table2.bh or table1.编号 is null 
    //反正加个条件了,你自己试试是 =''还是 is null 好了。
      

  3.   

    select table1.bh,table1.dj,table1.sl
    from table1
    left join (
    select table2.name from table2 
    ) table2 on table1.bh=table2.bh
      

  4.   

    select a.bh,a.dj,a.sl,b.name
    from table1 a,Table2 b
    where a.bh=b.bh
    union
    select a.bh,a.dj,a.sl,b.name
    from table1 a,Table2 b
    where a.bh not in(Select a.bh from table1 a,table2 b where a.bh=b.bh)
      

  5.   

    执行语句出错.
    ) table2 on table1.bh=table2.bh
      

  6.   

    试试下面:Select a.bh, b.name, a.dj, a.sl
    From Table1 a 
         Left Outer Join Table2 b
              On (a.bh = b.bh)通过外部左联接,即可实现你的需求。
      

  7.   

    试试下面:Select a.bh, b.name, a.dj, a.sl
    From Table1 a 
         Left Outer Join Table2 b
              On (a.bh = b.bh)通过外部左联接,即可实现你的需求。
      

  8.   

    select table1.bh,table2.name,table1.dj,table1.sl
    from table1 left outer join table2 on table1.bh=table2.bh
      

  9.   

    to
    wolfAone(¤一步一步网上爬¤) 你的方法执行可以通过。to  kyee(浪子阿鹏) 
    楼上的,执行完后也是我要的结果,谢谢,但是我不理解这语句的含义。
    是什么意思。另外我要按照cbh排序,可否实现
      

  10.   

    另外增加一个自增型的ID字段,select Table1.ID,......
    在DBGrid中不要显示出来就是了
      

  11.   

    用我的这个方法执行速度快,使用外部联接,其实也可以这样:Select a.bh, b.name, a.dj, a.sl
    From Table1 a, Table2 b
    Where a.bh *= b.bh试试?其实那只是基本的 SQL 语法。
      

  12.   

    使用left join
    select table1.bh,table1.dj,table1.sl,Table2.name
    from table1 left join  table2 on table1.bh=table2.bh
      

  13.   

    to kyee(浪子阿鹏) *= 这么简单就搞定了。
    同等于from table1 left outer join table2 on table1.bh=table2.bh外连接是吧