Msg 156, Level 15, State 1, Line 12
Incorrect syntax near the keyword 'SELECT'.
Please assist to rectify
MS-SQL SERVER -2008
Note No Surround for T-SQL
DECLARE @Request AS TABLE (Req_ID VARCHAR (20),
R1 INT, R2 INT, R3 INT, R4 INT, R5 INT)
INSERT INTO @Request VALUES('R12673',2, 5, 3, 7, 10)
INSERT INTO @Request VALUES('R34721',3, 5, 2, 1, 8)
INSERT INTO @Request VALUES('R27835',1, 3, 8, 5, 6
SELECT Req_ID,
(SELECT AVG(c)
FROM (VALUES(R1),
(R2),
(R3),
(R4),
(R5)) T (c)) AS [Average]
FROM @Request
What I have tried:
Program Codes. Needs help to correct the program segment