clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335489 fiddles created (27407 in the last week).

CREATE TABLE #Test ( Customer varchar(50) NOT NULL, [Fiscal Year] integer NOT NULL, [September Amount] smallmoney NULL, [October Amount] smallmoney NULL, [November Amount] smallmoney NULL );
 hidden batch(es)


INSERT #Test (Customer, [Fiscal Year], [September Amount], [October Amount], [November Amount]) VALUES ('Customer 1', 2020, $1.23, $2.34, $3.45), ('Customer 2', 2020, $4.56, $5.67, $6.78);
2 rows affected
 hidden batch(es)


SELECT U.Customer, U.[Fiscal Year], [Month] = LEFT(U.[Month], CHARINDEX(SPACE(1), U.[Month]) - 1), U.Amount FROM #Test AS T UNPIVOT ( Amount FOR [Month] IN ( [September Amount], [October Amount], [November Amount] ) ) AS U;
Customer Fiscal Year Month Amount
Customer 1 2020 September 1.2300
Customer 1 2020 October 2.3400
Customer 1 2020 November 3.4500
Customer 2 2020 September 4.5600
Customer 2 2020 October 5.6700
Customer 2 2020 November 6.7800
 hidden batch(es)


SELECT T.Customer, T.[Fiscal Year], U.[Month], U.Amount FROM #Test AS T CROSS APPLY ( VALUES ('September', T.[September Amount]), ('October', T.[October Amount]), ('November', T.[November Amount]) ) AS U ([Month], Amount);
Customer Fiscal Year Month Amount
Customer 1 2020 September 1.2300
Customer 1 2020 October 2.3400
Customer 1 2020 November 3.4500
Customer 2 2020 September 4.5600
Customer 2 2020 October 5.6700
Customer 2 2020 November 6.7800
 hidden batch(es)