用户连接可以,下面不知对不对,这样类似
select table1.bh,table1.dj,table1.sl
from table1
left join (
select table2.name from table2
) on table1.bh=table2.bh
select table1.bh,table1.dj,table1.sl
from table1
left join (
select table2.name from table2
) on table1.bh=table2.bh
select table1.bh,table1.dj,table1.sl
from table1
left join (
select table2.name from table2
) table2 on table1.bh=table2.bh
from table1,table2
where table1.bh=table2.bh or table1.编号 is null
//反正加个条件了,你自己试试是 =''还是 is null 好了。
from table1
left join (
select table2.name from table2
) table2 on table1.bh=table2.bh
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)
) table2 on table1.bh=table2.bh
From Table1 a
Left Outer Join Table2 b
On (a.bh = b.bh)通过外部左联接,即可实现你的需求。
From Table1 a
Left Outer Join Table2 b
On (a.bh = b.bh)通过外部左联接,即可实现你的需求。
from table1 left outer join table2 on table1.bh=table2.bh
wolfAone(¤一步一步网上爬¤) 你的方法执行可以通过。to kyee(浪子阿鹏)
楼上的,执行完后也是我要的结果,谢谢,但是我不理解这语句的含义。
是什么意思。另外我要按照cbh排序,可否实现
在DBGrid中不要显示出来就是了
From Table1 a, Table2 b
Where a.bh *= b.bh试试?其实那只是基本的 SQL 语法。
select table1.bh,table1.dj,table1.sl,Table2.name
from table1 left join table2 on table1.bh=table2.bh
同等于from table1 left outer join table2 on table1.bh=table2.bh外连接是吧