T-SQL – Get last 30 Rows for eacht ID

how can i get the last 30 rows in a month for each employee? i have a table with evaluations for each employee.

SELECT Date

,Month

,Team

,Employee_ID

,Evaluation_Score

,Evaluation_Case_Number

From X

Where month = @month

Order by date desc


This is what i got, but i only want to see the last 30 Evaluation Scores (or less, if they don't have that many) for the declared month.

Is there a way to do this? Thanks in Advance.



Read more here: https://stackoverflow.com/questions/66279221/t-sql-get-last-30-rows-for-eacht-id

Content Attribution

This content was originally published by NewbieSQL_Germany at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: