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
)

Amit MohantyPosted Feb 8, 2023, 12:58 PM
Check this
Sandeep KumarPosted Feb 9, 2023, 6:51 AM
how to apply paging on this linq query
Naimish MakwanaPosted Feb 8, 2023, 3:20 PM
Try below code with where condition on one place.
Thanks
Sandeep KumarPosted Feb 8, 2023, 12:56 PM
SS.VersionId ==( please here showing error
and i want set where condion in one place C.FacultyID=1
Naimish MakwanaPosted Feb 8, 2023, 12:15 PM
Hello Sandip,
Plese try below.
Thanks
Naimish