insert into test(fy1,fy2) select fy1 ,fy2 from (select sum(fy1) as fy1 from table1,select sum(fy2) as fy2 from table2);
不会吧,非要insert into test(fy1,fy2) select fy1 ,fy2 from (select sum(fy1) as fy1 from table1,select sum(fy2) as fy2 from table2); 这样写吗?用insert into test(fy1,fy2) values(select sum(fy1) from table1,select sum(fy2) from table2)这样的格式难道真没法吗?
values后面只能跟值,怎么能用表达式呢?
当然可以跟,我知道原因了,应该这样写: insert into test(fy1,fy2) values((select sum(fy1) from table1),(select sum(fy2) from table2));
select fy1 ,fy2 from (select sum(fy1) as fy1 from table1,select sum(fy2) as fy2 from table2);
select fy1 ,fy2 from (select sum(fy1) as fy1 from table1,select sum(fy2) as fy2 from table2);
这样写吗?用insert into test(fy1,fy2) values(select sum(fy1) from table1,select sum(fy2) from table2)这样的格式难道真没法吗?
insert into test(fy1,fy2) values((select sum(fy1) from table1),(select sum(fy2) from table2));