Hi,@coder rock. Welcome to Microsoft Q&A.
You could refer to the following code to achieve the function you want.
var personId = 1;
var query = from pd in t1
join fo in t2 on pd.CreatedBy equals fo.PersonId
where fo.IsActive == 1
join fap in t3 on pd.PersonId equals fap.PersonId into fapJoin
from fap in fapJoin.DefaultIfEmpty()
where fap == null || fap.TypeId == 232
join rd in t4 on pd.PersonId equals rd.PersonId into rdJoin
from rd in rdJoin.DefaultIfEmpty()
join pp in t5 on pd.PersonId equals pp.PersonId into ppJoin
from pp in ppJoin.DefaultIfEmpty()
where pd.CreatedBy == personId
select pd.PersonId;
var result = query.Distinct().ToList();
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.