多个查询结果,同时插入到一个数据表
jhhwb 2008-06-24 03:57:27 我想将多个查询结果,同时插入到一个数据表中,以两个为例说明,
表a
字段
aa
bb
cc 字段都是text类型
表b
dd
ee
ff 字段都是text类型
我想把这表a中aa字段为5的个数,表b中bb字段为34的个数,插入的b表的dd,ee字段
下面的语句
insert into b(dd,ee) values
(select count(*) from a where aa = '5 ',select count(*) from a where bb= '34 ')
不对
插入一条查询的时候
insert into b(dd)
select count(*) from a where aa = '5 ',可以插入正确的数据
但是
insert into b(dd,ee)
select count(*) from a where aa = '5 ',select count(*) from a where bb= '34 '
又是不对的
请问这条sql语句该怎么写?
请各位赐教啊 !