整合查询和临时表

--创建临时表

with 临时表名 as

(

--整合查询(两个查询结果合并)

--比如把父级和对应的子级查出

select * from a where a.id =3

union

select * from a where  a.kid = 3

)

--查询统计零时表

select Sum(Famount) from 临时表名

原文地址:https://www.cnblogs.com/linyijia/p/1862215.html