Please provide your table structure and sample data to get a speedy and correct response.Do you have anydate column to represent latest MARK?
You may need to use ROW_NUMBER() here
;With cte as
(Select *, ROW_NUMBER()Partition by (Student,Class,Subject order by latestdate desc) Rn
From yourtable Join secondtable......
) Select * From cte where rn=1
No comments:
Post a Comment