<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: LINQ To SQL Join On Multiple Conditions</title>
	<atom:link href="http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/</link>
	<description>Everything .Net</description>
	<lastBuildDate>Fri, 26 Feb 2010 15:39:54 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-6606</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Thu, 09 Jul 2009 09:26:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-6606</guid>
		<description>IanF, no worries.</description>
		<content:encoded><![CDATA[<p>IanF, no worries.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IanF</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-6555</link>
		<dc:creator>IanF</dc:creator>
		<pubDate>Wed, 08 Jul 2009 15:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-6555</guid>
		<description>Sorry ignore me, it is not the join that is causing the OR condition. I have run Profiler and I am getting superfluos null tests like this:

INNER JOIN [dbo].[BFDStateMachineTypeState] AS [Extent8] ON (([Extent7].[StateMachineTypeID] = [Extent8].[StateMachineTypeID]) [b]OR (([Extent7].[StateMachineTypeID] IS NULL) AND ([Extent8].[StateMachineTypeID] IS NULL)))[/b] AND (([Extent6].[StateID] = [Extent8].[StateID]) [b]OR (([Extent6].[StateID] IS NULL) AND ([Extent8].[StateID] IS NULL)))[/b]</description>
		<content:encoded><![CDATA[<p>Sorry ignore me, it is not the join that is causing the OR condition. I have run Profiler and I am getting superfluos null tests like this:</p>
<p>INNER JOIN [dbo].[BFDStateMachineTypeState] AS [Extent8] ON (([Extent7].[StateMachineTypeID] = [Extent8].[StateMachineTypeID]) [b]OR (([Extent7].[StateMachineTypeID] IS NULL) AND ([Extent8].[StateMachineTypeID] IS NULL)))[/b] AND (([Extent6].[StateID] = [Extent8].[StateID]) [b]OR (([Extent6].[StateID] IS NULL) AND ([Extent8].[StateID] IS NULL)))[/b]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IanF</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-6554</link>
		<dc:creator>IanF</dc:creator>
		<pubDate>Wed, 08 Jul 2009 15:13:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-6554</guid>
		<description>I can include a little bit, well the bit that is the offending part.

join E in bfd.BFDStateMachineTypeState
on new { D.StateMachineTypeID, A.StateID 
equals new { E.StateMachineTypeID, E.StateID }
join L in bfd.BFDStateMachineTypeService
on new { D.StateMachineTypeID, H.ServiceID }
equals new { L.StateMachineTypeID, L.ServiceID }

Thanks,

Ian</description>
		<content:encoded><![CDATA[<p>I can include a little bit, well the bit that is the offending part.</p>
<p>join E in bfd.BFDStateMachineTypeState<br />
on new { D.StateMachineTypeID, A.StateID<br />
equals new { E.StateMachineTypeID, E.StateID }<br />
join L in bfd.BFDStateMachineTypeService<br />
on new { D.StateMachineTypeID, H.ServiceID }<br />
equals new { L.StateMachineTypeID, L.ServiceID }</p>
<p>Thanks,</p>
<p>Ian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-6539</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Wed, 08 Jul 2009 11:20:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-6539</guid>
		<description>Ian,

What does your LINQ query look like? Can you post it here?</description>
		<content:encoded><![CDATA[<p>Ian,</p>
<p>What does your LINQ query look like? Can you post it here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IanF</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-6538</link>
		<dc:creator>IanF</dc:creator>
		<pubDate>Wed, 08 Jul 2009 11:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-6538</guid>
		<description>Hi this is great unfortunatley it results in an &#039;OR&#039; for me and not an AND. i.e.:

SELECT [t0].[ShoppingMallId], [t0].[Address],[t0].[PostCode], [t0].[CouncilCode]FROM [dbo].[ShoppingMall] AS [t0]INNER JOIN [dbo].[House] AS [t1]ON ([t0].[CouncilCode] = [t1].[CouncilCode])OR ([t0].[PostCode] = [t1].[PostCode])</description>
		<content:encoded><![CDATA[<p>Hi this is great unfortunatley it results in an &#8216;OR&#8217; for me and not an AND. i.e.:</p>
<p>SELECT [t0].[ShoppingMallId], [t0].[Address],[t0].[PostCode], [t0].[CouncilCode]FROM [dbo].[ShoppingMall] AS [t0]INNER JOIN [dbo].[House] AS [t1]ON ([t0].[CouncilCode] = [t1].[CouncilCode])OR ([t0].[PostCode] = [t1].[PostCode])</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike313t</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-5835</link>
		<dc:creator>mike313t</dc:creator>
		<pubDate>Wed, 24 Jun 2009 18:04:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-5835</guid>
		<description>What if when joining  one condition is an &quot;equals&quot;
and another condition is &quot;not equals&quot;?</description>
		<content:encoded><![CDATA[<p>What if when joining  one condition is an &#8220;equals&#8221;<br />
and another condition is &#8220;not equals&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-1226</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Wed, 11 Feb 2009 22:29:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-1226</guid>
		<description>mp09ind,

context is my DataContext here which I generated using Visual Studio designer. You can find more details on how to do that here.

http://www.onedotnetway.com/linq-to-sql-tutorial/</description>
		<content:encoded><![CDATA[<p>mp09ind,</p>
<p>context is my DataContext here which I generated using Visual Studio designer. You can find more details on how to do that here.</p>
<p><a href="http://www.onedotnetway.com/linq-to-sql-tutorial/" rel="nofollow">http://www.onedotnetway.com/linq-to-sql-tutorial/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mp09ind</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-1219</link>
		<dc:creator>mp09ind</dc:creator>
		<pubDate>Wed, 11 Feb 2009 12:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-1219</guid>
		<description>What is context here?</description>
		<content:encoded><![CDATA[<p>What is context here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-784</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Mon, 29 Dec 2008 22:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-784</guid>
		<description>Thanks for the tip jwright.</description>
		<content:encoded><![CDATA[<p>Thanks for the tip jwright.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jwright</title>
		<link>http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/comment-page-1/#comment-782</link>
		<dc:creator>jwright</dc:creator>
		<pubDate>Mon, 29 Dec 2008 18:13:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.onedotnetway.com/linq-to-sql-join-on-multiple-conditions/#comment-782</guid>
		<description>something to keep in mind.
if your joining two tables where the linking columns have different names, the anonymous types&#039; properties must match.
i.e.,

var query = from s in context.ShoppingMalls
            join h in context.Houses
            on
            new {CouncilCode=s.CouncilCode, PostCode=s.PostCode }
            equals
             new {CouncilCode=h.District, PostCode=h.ZipCode }
            select s;</description>
		<content:encoded><![CDATA[<p>something to keep in mind.<br />
if your joining two tables where the linking columns have different names, the anonymous types&#8217; properties must match.<br />
i.e.,</p>
<p>var query = from s in context.ShoppingMalls<br />
            join h in context.Houses<br />
            on<br />
            new {CouncilCode=s.CouncilCode, PostCode=s.PostCode }<br />
            equals<br />
             new {CouncilCode=h.District, PostCode=h.ZipCode }<br />
            select s;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
