sql如何将用语句查询出来的结果插入一个表
selectcompanyinfo.orderitem.proID,sum(buynum)asabuynumfromcompanyinfo.orderitemgroupb...
select companyinfo.orderitem.proID,sum(buynum) as abuynum from companyinfo.orderitem group by proID 将上述语句的查询结果插入一个表
展开
展开全部
试试:
--插入新表
select companyinfo.orderitem.proID,sum(buynum) as abuynum
into 新表
from companyinfo.orderitem group by proID
--插入已存在的表
insert into 已存在的表(proID,abuynum)
select companyinfo.orderitem.proID,sum(buynum) as abuynum from companyinfo.orderitem group by proID
祝你成功!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询