当前位置: 代码迷 >> Sql Server >> 关于临时表的有关问题
  详细解决方案

关于临时表的有关问题

热度:88   发布时间:2016-04-27 15:09:28.0
关于临时表的问题
我先有2张表   表1有一个价格,其中值是输入.   表2也有一个价格,它是由公式生成的.

如何做一张临时表,把这两张表查的到的价格填充到临时表的价格当中去.

------解决方案--------------------
select 价格 into # from
(
select 价格 from 表1
union all
select 价格 from 表2
)a
------解决方案--------------------
create table #tmp(price decimal(18,1))
insert #tmp select price from 表1 union all select price from 表2
select * from #tmp
go
------解决方案--------------------
create table #tmp(price decimal(18,1))
insert #tmp select price from 表1 union all select price from 表2
select * from #tmp
go


------解决方案--------------------
select price into #temp from 表1 union all select price from 表2
select * from #tmp
  相关解决方案