LINQ to SQL - Left Outer Join with multiple join conditions?

You need to introduce your join condition before calling DefaultIfEmpty() I would just use extension method syntax: from p in context. Periods join f in context. Facts on p.Id equals f.

Periodid into fg from fgi in fg. Where(f => f. Otherid == 17).DefaultIfEmpty() where p.

Companyid == 100 select f. Value Or you could use a subquery: from p in context. Periods join f in context.

Facts on p. Id equals f. Periodid into fg from fgi in (from f in fg where f.

Otherid == 17 select f).DefaultIfEmpty() where p. Companyid == 100 select f.value.

You need to introduce your join condition before calling DefaultIfEmpty(). I would just use extension method syntax: from p in context. Periods join f in context.

Facts on p. Id equals f. Periodid into fg from fgi in fg.

Where(f => f. Otherid == 17).DefaultIfEmpty() where p. Companyid == 100 select f.

Value Or you could use a subquery: from p in context. Periods join f in context. Facts on p.Id equals f.

Periodid into fg from fgi in (from f in fg where f. Otherid == 17 select f).DefaultIfEmpty() where p. Companyid == 100 select f.value.

Thanksssssssssssss........ solves my problemo! – effkay Mar 11 '10 at 8:57 +1 Helped me too :) – Rashmi Pandit Nov 26 '10 at 8:45 Thanks your answer helped me a great deal! – Aros Jul 6 at 21:17.

Another valid option is to spread the joins across multiple LINQ clauses, as follows: public static IEnumerable GetSiteContent(string pageName, DateTime date) { IEnumerable content = null; IEnumerable addMoreContent = null; try { content = from c in DB. Announcementboards //Can be displayed beginning on this date where c. Displayondate > date.

AddDays(-1) //Doesn't Expire or Expires at future date && (c. Displaythrudate == null || c. Displaythrudate > date) //Content is NOT draft, and IS published && c.

Isdraft == "N" && c. Publishedon! = null orderby c.

Sortorder ascending, c. Heading ascending select c; //Get the content specific to page names if (!string. IsNullOrEmpty(pageName)) { addMoreContent = from c in content join p in DB.

Announceonpages on c. Announcementid equals p. Announcementid join s in DB.

Apppagenames on p. Apppagenameid equals s. Apppagenameid where s.Apppageref.ToLower() == pageName.ToLower() select c; } //CROSS-JOIN this content content = content.

Union(addMoreContent); //Exclude dupes - effectively OUTER JOIN content = content.Distinct(); return content; } catch (MyLovelyException ex) { throw ex; } }.

MAbraham's answer is very cool, but I think it has the potential of returning a huge dataset and then filtering which would slow down the process.

Join p in DB. Announceonpages on c. Announcementid equals p.

Join s in DB. Apppagenames on p. Apppagenameid equals s.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions