Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > LINQ
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 21st, 2009, 10: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?
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10:54 AM
left outer join 2 or 3 tables in ms access keyvanjan Classic ASP Basics 2 February 2nd, 2006 05:42 PM
left outer join 2 or 3 tables in ms access keyvanjan SQL Server ASP 0 January 30th, 2006 02:33 AM
Left Outer Join with Crystal navinkumar1 Crystal Reports 0 October 21st, 2004 01:02 PM



All times are GMT -4. The time now is 01:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.