clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3798917 fiddles created (41832 in the last week).

SELECT 01254601144 as UPC, 90 as TotalUnits, '2018-04-14' as Date INTO #RTG_Lookup2_4_Ago SELECT 01254601144 as UPC, 107 as TotalUnits, '2018-04-21' as Date INTO #RTG_Lookup2_3_Ago SELECT 01254601144 as UPC, 132 as TotalUnits, '2018-04-28' as Date INTO #RTG_Lookup2_2_Ago SELECT 01254601144 as UPC, 98 as TotalUnits, '2018-05-05' as Date INTO #RTG_Lookup2_Last1 SELECT MIN(Ago.TotalUnits) AS LowMvmt, MAX(Ago.TotalUnits) AS HighMvmt FROM ( SELECT * FROM #RTG_Lookup2_4_Ago UNION SELECT * FROM #RTG_Lookup2_3_Ago UNION SELECT * FROM #RTG_Lookup2_2_Ago UNION SELECT * FROM #RTG_Lookup2_Last1 ) AS Ago
LowMvmt HighMvmt
90 132
 hidden batch(es)