日期:2014-05-18 浏览次数:20424 次
create table aa(item varchar(100),zt varchar(100)) go insert into aa select item,case when td018 = 'Y' then TD018为采购数量 else 0 end - TD015为供应商已交数量 from PURTD go drop table aa
------解决方案--------------------
create table #aa(item varchar(20),zt varchar(20)); go insert #aa(item,zt) select td004,TD018-TD015t from purtd where td016 = 'N' and td018 = 'Y'
------解决方案--------------------
临时表有全局和局部的,当是局部时仅存在于当前会话,会话结束后临时表自动清除
------解决方案--------------------
create table #aa(item varchar(100),zt varchar(100)) go insert into #aa select item, TD08 - TD015 from PURTD when td018 = 'Y' go drop table #aa