标签:
ROW_NUMBER() OVER(ORDER BY f.biaodanid desc) as KeyId
declare @yymm nvarchar(10)
set @yymm =‘2015-04-08‘
select f.biaodanid ‘订单号‘,d.dingdanshuliang ‘订单数量‘,s.stock_id ‘物料号‘,name ‘物料名称‘, f.sumsl ‘发料量‘,ROUND(f.price,4) ‘单价‘,
ROW_NUMBER() OVER(ORDER BY f.biaodanid desc) as KeyId
into BPM.dbo.erpA_rep_F3
from stock_sum s,dingdanfu f,dingdanzhu d
where s.stock_id = f.xuhao
and d.biaodanid = f.biaodanid
and CONVERT(char(10),cwdate,120) = @yymm order by stock_id,d.biaodanid
标签:
原文地址:http://www.cnblogs.com/szlixin/p/4409538.html