Sandeep Kumar

Sandeep Kumar

  • 1.1k
  • 683
  • 59.2k

I want fetch this record using Linq in .net Core

Feb 8 2023 11:44 AM

I m writing a Api in .net core To fetch  Below record as shown in image

How can i write this query in linq in simple way

My sql query

select SS.VersionId,SS.ContentId,SS.CourseName,SS.DeptName from (SELECT C.ContentTypeId,C.Id,V.VersionId,V.VersionName,C.CourseName,C.DeptName,V.ContentId
FROM  [dbo].[ContentDetails] C inner join [dbo].[VersionDetails] V on C.Id=V.ContentId  
WHERE  C.FacultyID=1 
)SS where SS.VersionId in
(
select Max(V.VersionId)
  FROM [dbo].[ContentDetails] C inner join [dbo].[VersionDetails] V on C.Id=V.ContentId  where C.FacultyID=1
group by V.ContentId  

)


Answers (5)