数量的欲望输出 [英] Desire Output for Amount
问题描述
DECLARE @T AS TABLE(ID INT,SAL NUMERIC(10,5),WE_DATE DATE)
DECLARE @T AS TABLE (ID INT, SAL NUMERIC(10,5),WE_DATE DATE)
INSERT INTO @T
INSERT INTO @T
SELECT 1,100,'2018-03-10'UNION ALL
SELECT 1,100,'2018-03-10' UNION ALL
SELECT 1,75,'2018-03-10'UNION ALL
SELECT 1,75,'2018-03-10' UNION ALL
SELECT 1,60,'2018-03-07'UNION ALL
SELECT 1,60,'2018-03-07' UNION ALL
SELECT 1,50,'2018-03-07'
SELECT 1,50,'2018-03-07'
输出
1,100,2018-03-10,60,2018-03-07
1,100,2018-03-10,60,2018-03-07
1,100 ,2018-03-10,50,2018-03-07
1,100,2018-03-10,50,2018-03-07
输出数据集应该有最新的 sal we_date和last sal,last_we_date wrt Id
Output Dataset should have current sal we_date and last sal ,last_we_date w.r.t Id
请建议
推荐答案
它应该有sal,we_date和last sal,last_we_date,即当前week_end_date sal,last week_end_date sal
It should have sal,we_date and last sal, last_we_date i.e current week_end_date sal, last week_end_date sal
side by方
这篇关于数量的欲望输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!