简单问题,救救我吧!

freevc 2003-05-20 04:35:17
我要把A表里的记录如何导入B表里:
A表:C_ID、C2、C3
id、 a1_v1、...
id、 a2_v1、...
id、 a3_v1、...
导入 到B表
B表:C_ID、a1、 a2、 a3
id、 a1_v1、 a2_v1、 a3_v1
怎么导
...全文
11 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
HawaiiLeo 2003-05-20
insert into B(C_ID, a1, a2, a3)
select A1.C_ID, ISNULL(A1.C2,NULL), ISNULL(A2.C2,NULL), ISNULL(A3.C2,NULL) from A A1
left join A A2 on A1.C_ID = A2.C_ID
left join A A3 on A1.C_ID = A3.C_ID
where A1.C_ID in (select distinct C_ID from A)
回复
HawaiiLeo 2003-05-20
insert into B(C_ID, a1, a2, a3)
select A1.C_ID, ISNULL(A1.C2,NULL), ISNULL(A2.C_ID,NULL), ISNULL(A3.C_ID,NULL) from A A1
left join A A2 on A1.C_ID = A2.C_ID
left join A A3 on A1.C_ID = A3.C_ID
where A1.C_ID in (select distinct C_ID from A)
回复
相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2003-05-20 04:35
社区公告
暂无公告