mysql从多个选择查询插入到表中

时间:2016-01-22 16:40:38

标签: mysql

如何将其合并为单个插入

INSERT INTO masterTable (count1) select count(*) as count1 from tablex
INSERT INTO masterTable (count2) select count(*) as count2 from tabley
INSERT INTO masterTable (count3) select count(*) as count3 from tablez

1 个答案:

答案 0 :(得分:1)

INSERT INTO MasterTable (count1,count2,count3) 
VALUES ((select count(*) from tablex),(select count(*) from tabley),(select count(*) from tablez))
相关问题