Vc+ado+acces下
有两表a(num,name),b(num,count)
a表有数据 num name
1 a
2 b
3 c
b表有数据 num count
1 10
2 15
使用怎样一SQL语句使得结果为:
num name count
1 a 10
2 b 15
3 c null
我已通过select a.num,a.name,b.count from a LEFT OUTER JOIN b ON a.num=b.num实现,想问一下还有没有其他方法
有两表a(num,name),b(num,count)
a表有数据 num name
1 a
2 b
3 c
b表有数据 num count
1 10
2 15
使用怎样一SQL语句使得结果为:
num name count
1 a 10
2 b 15
3 c null
我已通过select a.num,a.name,b.count from a LEFT OUTER JOIN b ON a.num=b.num实现,想问一下还有没有其他方法
就是左外连接,没有更好的了select a.[num],a.[name],b.[count] from a表 as a Left Join b表 as b on a.num=b.num
select a.num,a.name,decode(b.count,null,'null',b.count)
from a,b where a.num=b.num(+);
左外连接??
{ LOOP | HASH | MERGE | REMOTE }参数
LOOP | HASH | MERGE指定查询中的联接应使用循环、哈希或合并。使用 LOOP | HASH | MERGE JOIN 将在两个表之间强制一个特定联接。 MS SQL Server 有这样的用法...不过不见得就是你要的...呵呵...:@
好像Access 不支持