select P.Id,p.Name,pp.Weightage from Person p inner join
(Select * from
(
SELECT *
FROM [SL_Project_Management].[dbo].[PersonWiseActionHistory] where Id in ( select MAX(Id) from [SL_Project_Management].[dbo].[PersonWiseActionHistory] group by PersonId) )ss
where convert(nvarchar(10),EffectFrom,103)=convert(nvarchar(10),'24/06/2022',103) and ActionTypeId=1)pp
on p.Id=pp.PersonId

Sandeep KumarRank #1,642 · 937 reputationPosted Jul 7, 2022, 2:59 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jul 7, 2022, 3:57 AM EDT
You can use somthing like this
var Ids= _context.PersonWiseActionHistory.GroupBy(x=> x.PersonId).selectMany(x=>x.OrderByDescending(x=>x.Id).FirstOrDefault().Id
);
var list1=_context.PersonWiseActionHistory.Where(x=>Ids.Contains(x.Id)).ToList();
var res=(from p in _Context.Person
Join b in list1
on p.Id equals b.PersonId
where Convert.ToDateTime(p.EffectFrom).Date()= Convert.ToDateTime("24/06/2022").Date()
&& ActionTypeId=1
select new { p, b}
Sandeep KumarRank #1,642 · 937 reputationPosted Jul 7, 2022, 4:27 AM EDT
there is a error showing
Sandeep KumarRank #1,642 · 937 reputationPosted Jul 7, 2022, 6:09 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jul 7, 2022, 6:41 AM EDT
Sandeep KumarRank #1,642 · 937 reputationPosted Jul 7, 2022, 6:53 AM EDT
i have used select in place of select many
bit id not able to find
Sandeep KumarRank #1,642 · 937 reputationPosted Jul 7, 2022, 7:24 AM EDT
PhamNgoc Khiem39 reputationPosted Jul 13, 2022, 2:55 AM EDT