Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > LINQ
|
LINQ Discuss Microsoft's LINQ (Language INtegrated Query) for .NET 3.0 and later.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the LINQ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2009, 11:05 AM
Registered User
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default left outer join

I've looked all over at different topics on this and I'm still having problems.

I'm trying to perform a left outer join with linq. I'm not having any luck. Here's my code:

Code:
var query = dataContext.Title.Where(
t => t.JobID == jobID && dataContext.EstimateRequestTitle.Any(ert => ert.TitleID == t.TitleID));

var query2 = query.DefaultIfEmpty()
.Join(dataContext.EthicalCategory.DefaultIfEmpty() , t => t.EthicalCategoryID, ec => ec.EthicalCategoryID,
(t, ec) =>
new
{
t.ISBN,
t.TitleID,
t.TitleName,
t.EthicalCategoryID,
EthicalCategoryName = ec.CategoryName,
ec.AccreditingBodyID
}).DefaultIfEmpty();
As you can see, I've ended up adding DefaultIfEmpty ALL OVER the place and yet query2 still doesn't contain any records when query does. No matter what I do, the sql it produces always contains at least one inner join.

Can anyone help?





Similar Threads
Thread Thread Starter Forum Replies Last Post
left outer join keyvanjan Classic ASP Basics 1 April 15th, 2006 05:37 AM
left outer join keyvanjan Classic ASP Professional 0 February 5th, 2006 11:54 AM
left outer join 2 or 3 tables in ms access keyvanjan Classic ASP Basics 2 February 2nd, 2006 06:42 PM
left outer join 2 or 3 tables in ms access keyvanjan SQL Server ASP 0 January 30th, 2006 03:33 AM
Left Outer Join with Crystal navinkumar1 Crystal Reports 0 October 21st, 2004 01:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.