SELECT PP.ProductID
,P.ProductDescription
,PP.ProductPrice
,PP.EffectiveStartDT
,EffectiveEndDT=LEAD(EffectiveStartDT,1) OVER(PARTITION BY PP.ProductID ORDER BY EffectiveStartDT)
FROM Temp14_Plan AS PP,Temp14_Product AS P
WHERE PP.ProductID=P.ProductID
ORDER BY ProductID
SELECT PP.ProductID
,P.ProductDescription
,PP.ProductPrice
,PP.EffectiveStartDT
,EffectiveEndDT=LEAD(EffectiveStartDT,1,'1900-01-01') OVER(PARTITION BY PP.ProductID ORDER BY EffectiveStartDT)
FROM Temp14_Plan AS PP,Temp14_Product AS P
WHERE PP.ProductID=P.ProductID
2 个回复
悟 - 取是能力,舍是境界 2016-05-23 回答
赞同来自:
wenti 2016-05-23 回答
赞同来自: