Reputation: 780
I want to get the records in citizen table that have a record in job table using LINQ. Can someone please translate this in LINQ? Thanks!
SELECT * FROM JOB_MSTR j where j.citizen_id IN (SELECT c.citizen_id from CITIZEN_MSTR c);
Upvotes: 0
Views: 1139
Reputation: 45947
This sould do it
ctx.JOB_MSTR.Where(x => ctx.CITIZEN_MSTR.Any(y => y.citizen_id == x.citizen_id))
Upvotes: 4
Reputation: 616
var result = ( from j in ctx.JOB_MSTR
join c in ctx.CITIZEN_MSTR
on j.citizen_id equals c.citizen_id
select j).ToList();
Upvotes: 2