Hello Shan,
In you first SELECT statement, oyu query Cls.ID, but in the FROM clause you have only tbale QR2 with alias Dim; but no thate Cls, therefore you get this error.
elect enroll,Dim.regdate, Cls.ID, rn=ROW_NUMBER() over (partitiOn by enroll order by Dim.regdate)
INTO #Qry
From QR2 As Dim
Where Cast(Dim.regdate As datetime) between @From And @to
And enroll not in (12345129,124818243)
And Dim.Stud_ID not IN (112409,12349,12139,121349,213140,12134)
Olaf Helper
Blog Xing
No comments:
Post a Comment