Pakeeza

Pakeeza

  • 1.6k
  • 107
  • 4.8k

get the latest record from the list .

Jan 17 2024 7:21 PM

Dear All I have this table as shown below 

ID Student_Name Marks Course_ID
1 ABC 78 1
2 HHH 88 3
3 ABC 89 1
4 ABC 99 1
5 CCC 67 2
6 HHH 76 3
       

From above table I would like to get the records I would like to take one record for each course ID but that records must be the latest one for that course ID like for course ID =1 the record I need to get should have ID =4 as this is the latest for course _ID 1 , same as for HHH I need to get row 6 and 6 is the latest record this is auto increament Id , and for CCC as there is only one record so I need to get 5th row, how to get this in linq query


Answers (6)