I'm about to throw this pc out of the window - it runs fine on my home pc but won't run on my work pc.
Both versions of SSMS are v18.6.
Error message:
Msg 102, Level 15, State 1, Line 38
Incorrect syntax near 'ORDER'
DECLARE @test AS TABLE
(
Yr INT,
Period INT,
Volume INT
)
INSERT INTO @test
VALUES
(
'2019', '4', '75'
)
INSERT INTO @test
VALUES
(
'2019', '5', '75'
)
INSERT INTO @test
VALUES
(
'2019', '6', '75'
)
INSERT INTO @test
VALUES
(
'2019', '7', '75'
)
INSERT INTO @test
VALUES
(
'2019', '8', '75'
)
INSERT INTO @test
VALUES
(
'2019', '9', '75'
)
SELECT Yr, Period, Volume, SUM (Volume) OVER (ORDER BY Yr, Period) FROM @test