Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Please any buddy help me to convert below sql query to linq.

Select b.DISTRICT,b.TEHSIL,b.UID,b.BeneficiaryFullname,b.BeneficiaryRationCardID, b.Gender
from
(
select BeneficiaryRationCardID, min(DOB) as MaxAge
from BPLFamilyDetails where gender='F'
group by BeneficiaryRationCardID
) a
inner join BPLFamilyDetails b on a.BeneficiaryRationCardID=b.BeneficiaryRationCardID and a.MaxAge=b.DOB
inner join
(
select x.BeneficiaryRationCardID
from BPLFamilyDetails x
left join (select BeneficiaryRationCardID from BPLFamilyDetails where UID is null) y on x.BeneficiaryRationCardID=y.BeneficiaryRationCardID
where y.BeneficiaryRationCardID iS null
group by x.BeneficiaryRationCardID
) c on a.BeneficiaryRationCardID=c.BeneficiaryRationCardID
where b.Gender='F'

What I have tried:

I have tried for online tool to convert query from sql to linq but didnt succeed.
please help me to get out of this.
Posted
Updated 4-Jan-22 20:24pm

Linqer is a SQL to LINQ converter tool. It helps to learn LINQ and convert raw SQL statements to LINQ. Linqer supports both .NET languages - C# and Visual Basic. Follow below link to download the tool:

Linqer[^]
 
Share this answer
 
v2
Comments
[no name] 2-Sep-20 6:10am    
select count(SampleTypeCollections.id) as sampleCount from SampleTypeCollections
WHERE sampletypecollections.id in (select SampleId from SampleTest
join SampleTestDiseases on SampleTestDiseases.SampleTestId = SampleTest.id
join SampleTestPerformed on SampleTestPerformed.sampletestid = sampletest.id
where SampleTest.SampleId = sampletypecollections.id and SampleTestPerformed.TestResultId = 2
and(SampleTypeCollections.CreateDate BETWEEN to_date('9/9/2020' , 'dd/mm/yyyy') AND to_date('9/2/2020', 'dd/mm/yyyy')))
Try this linq 101

101 LINQ Samples in C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900