Click here to Skip to main content
15,498,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Select b.DISTRICT,b.TEHSIL,b.UID,b.BeneficiaryFullname,b.BeneficiaryRationCardID, b.Gender
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'

[link to TV/Movie collection has been removed]

What I have tried:

I have tried for online tool to convert query from sql to linq but didnt succeed.
Updated 16-Jan-22 1:14am
Afzaal Ahmad Zeeshan 15-Jan-22 19:22pm    
I would keep this query in SQL for performance reasons and map the records/results to C# instead. :-)

See LINQ to SQL example here: Getting Started - ADO.NET | Microsoft Docs[^]
Share this answer
Maciej Los 16-Jan-22 3:39am    
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