怎么把从多个表查询得到的数据插入临时表中
展开全部
详细代码如下:
select * into #1 from
( select a.yzmc as 名称,sum(a.zl) as 数量 ,sum(a.je) as 金额 ,b.mc as 科室 from zy_bhjfyz201303 a,zd_ks b where a.ksbm=b.bm and a.fylb in (87,88,99,100) and a.rq between 41326 and 41353 and a.flag& 16=0 and a.flag & 2>0 group by a.yzmc,a.ksbm,b.mc)
t
select * into #1 from
( select a.yzmc as 名称,sum(a.zl) as 数量 ,sum(a.je) as 金额 ,b.mc as 科室 from zy_bhjfyz201303 a,zd_ks b where a.ksbm=b.bm and a.fylb in (87,88,99,100) and a.rq between 41326 and 41353 and a.flag& 16=0 and a.flag & 2>0 group by a.yzmc,a.ksbm,b.mc)
t
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询