Hi,
I want to left outer join 2 tables called a and b.In the Where clause I want to check properties from both tables i.e like this

var query = from a in data.A
                    join b in data.B
                    on a.id == b.id
                    where a.marks = 1 && b.archived == false
                    into c
                    let d= c.FirstOrDefault()

But i cant check for the b.archived == false condition.How can I do this?
thnx in Advance

Recommended Answers

All 4 Replies

Error:

where a.marks == 1

Hi
Thnx for replying.It was a mistake happened when i posted the code.Still I have the problem.I want to check a property of the table which is in the right hand side of the join i.e b.archived == false.Any method that I can use for it?

take the b in coding acess in function system may u get it

I have the same problem with multiple joins. Here is the query:

Data data = (from scr in entities.SponsoredCharitableReportsSet
                             from company in entities.CompanySet.Where(c => c.ID == scr.CompanyID)
                             from user in entities.UserSet.Where(u => u.MemberID == scr.MemberID)
                             where scr.ID == DetailsID
                             orderby scr.DateRequested, company.CompanyName, user.FullName
                             select new Data
                             {
                                 ID = (company == null ? 0 : company.ID),
                                 DetailsID = scr.ID,
                                 CompanyName = (company == null ? String.Empty : company.CompanyName),
                                 Type = (company == null) ? String.Empty : company.Type,
                                 WhoReceives = scr.WhoReceives,
                                 RequestedCompanyName = scr.RequestedCompanyName,
                                 DateRequested = scr.DateRequested,
                                 RequestedCompanyID = scr.RequestedCompanyID,
                                 AmountCharged = scr.AmountCharged,
                                 InvoiceNumber = scr.InvoiceNumber,
                                 Comments = scr.Comments,
                                 FullName = (user == null ? String.Empty : user.FullName),
                                 Phone = (user == null ? String.Empty : user.Phone),
                                 MemberID = (user == null ? String.Empty : user.MemberID),
                                 SendToBusinessMembers = scr.SendToBusinessMembers,
                                 SendToResidentialMembers = scr.SendToResidentialMembers,
                                 SendToAllMembers = scr.SendToAllMembers,
                                 SendToIndividualMembers = scr.SendToIndividualMembers,
                                 SendToNonMember = scr.SendToNonMember,
                                 NonMemberEmail = scr.NonMemberEmail,
                                 IndividualMembers = scr.SendToMembersList
                             }).First();

The SponsoredCharitableReportsSet table has a valid record. The CompanySet has a matching ID for the CompanyID in SponsoredCharitableReportsSet. The UserSet table DOES NOT have a record with a matching MemberID. I want all records from SponsoredCharitableReportsSet to come back regardless of a record in company or user. The query only returns a match if I comment out the "from user" line and any references to user. Why is this happening? There must be something wrong with my query that I dont understand.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.