I got this error message:
Msg 4108, Level 15, State 1, Line 3
Windowed functions can only appear in the SELECT or ORDER BY clauses.
when running the following codes:
select * ,row_number() over (partition by Age order by Time ) as RowN
where row_number() over (partition by Age order by Time ) <=2
order by Age,Rown
From what I can understand, row_number() cannot be used in where clause?