when i try i get this error Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'Declare'.
SELECT Expressed, admno
FROM dbo.Archivedreports
WHERE (Class NOT LIKE N'PRE%')
GROUP BY Expressed, admno
HAVING (Expressed IS NOT NULL)
union
declare @type nvarchar(50)
Declare @TestVal nvarchar(50)
select @type=ExamType from ExamType where stream ='ALL'
SET @TestVal = @type
SELECT @TestVal, admno
FROM dbo.GENERALDATA
WHERE (Class NOT LIKE N'PRE%')
GROUP BY @TestVal, admno
HAVING (@TestVal IS NOT NULL)