这样的SQL语句能写出?...
这样的SQL语句能写出?...
表A. 编号,姓名
表B 编号,姓名
表C 编号,姓名
要求:把表A的数据插入表B (其中条件如果表C和表A同时有的姓名,不能插入表B)
SQL语句应该如何写?
问题点数:20、回复次数:4Top
1 楼yesterday2000(一笑而过)回复于 2004-09-04 18:19:18 得分 3
insert into 表B
select a.编号,a.姓名
from 表A A,表C B
where a.姓名<>b.姓名Top
2 楼chinaandys(降龙十八炒&&蛋炒饭)回复于 2004-09-04 18:20:30 得分 3
select * into 表b from 表A a where not exists(select a.编号,a.姓名
from 表c c where a.姓名=c.姓名)Top
3 楼lzymagi(逸)回复于 2004-09-04 18:22:10 得分 3
insert b select 编号,姓名 from (select * from a where 姓名 in (select 姓名 from c))
Top
4 楼qiliu(痴心求学)回复于 2004-09-04 18:22:38 得分 11
insert 表B
select * from 表A a where a.姓名 not in (select 姓名 from 表C where 姓名=a.姓名)Top




