table AID 1
2
3
4
5table B
ID NAME2 AA
4 BB
5 CC
------------------------------------
如何得到这样的结果
ID NAME
1
2 AA
3
4 BB
5 CC请各位支个招???谢谢~!
2
3
4
5table B
ID NAME2 AA
4 BB
5 CC
------------------------------------
如何得到这样的结果
ID NAME
1
2 AA
3
4 BB
5 CC请各位支个招???谢谢~!
解决方案 »
- 执行删除操作超时怎么办?
- 删除一个表并且记录到日志文件里和不记录到日志文件里,语句有什么区别?
- 请教如何回收数据表未使用的空间呢?
- 请教高手一个SQL统计语句
- 请问如何加密数据库呀?
- sql server 2000的表字段中的什么字符到.net中是\n?
- 请问如何修改或删除作业?
- 请问怎样用select将用户表的结构输出到EXECL表中?表比较多,手工太麻烦了,请有经验的帮帮忙
- 请问sql 时的关系有什么用常用吗?
- 我把doc、jpeg、text等文件写入sql2000的image类型字段中,现在希望把它们从image中读出并生成一个文件,或者直接显示在网页上,用asp.net
- 查询某个库下的所有表名
- sql BCP 动态批量导出数据
b.name
from ta a left join tb b
on a.id=b.id
drop table ta
Go
Create table ta([ID] int)
Insert ta
select 1 union all
select 2 union all
select 3 union all
select 4 union all
select 5
Go
if not object_id('tb') is null
drop table tb
Go
Create table tb([ID] int,[NAME] nvarchar(2))
Insert tb
select 2,N'AA' union all
select 4,N'BB' union all
select 5,N'CC'
Go
select a.id,
isnull(b.name,'')[name]
from ta a left join tb b
on a.id=b.id
/*
id name
----------- ----
1
2 AA
3
4 BB
5 CC(5 row(s) affected)*/