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
PhamNgoc KhiemPosted Jul 13, 2022, 6:55 AM
Sandeep KumarPosted Jul 7, 2022, 11:24 AM
Sandeep KumarPosted Jul 7, 2022, 10:53 AM
i have used select in place of select many
bit id not able to find
Sachin SinghPosted Jul 7, 2022, 10:41 AM
Sandeep KumarPosted Jul 7, 2022, 10:09 AM
Sandeep KumarPosted Jul 7, 2022, 8:27 AM
there is a error showing
Sachin SinghPosted Jul 7, 2022, 7:57 AM
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 KumarPosted Jul 7, 2022, 6:59 AM