<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Left Join, Right Join Using LINQ</title>
	<atom:link href="http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/</link>
	<description>Bridge to future</description>
	<lastBuildDate>Tue, 15 Dec 2009 04:30:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: codingsense</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-130</link>
		<dc:creator>codingsense</dc:creator>
		<pubDate>Tue, 23 Jun 2009 04:46:48 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-130</guid>
		<description>Hi Dan, 

Everything seems to be fine.

Thanks,
Naveen Prabhu</description>
		<content:encoded><![CDATA[<p>Hi Dan, </p>
<p>Everything seems to be fine.</p>
<p>Thanks,<br />
Naveen Prabhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-129</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Mon, 22 Jun 2009 19:46:53 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-129</guid>
		<description>Naveen,

I have found ananswer.  The &quot;Select&quot; line should be 
&quot;Select Total_Hours = TC.Productive_Hours_Qty&quot;.  If there is a better way please let me know.

Thanks,
Dan</description>
		<content:encoded><![CDATA[<p>Naveen,</p>
<p>I have found ananswer.  The &#8220;Select&#8221; line should be<br />
&#8220;Select Total_Hours = TC.Productive_Hours_Qty&#8221;.  If there is a better way please let me know.</p>
<p>Thanks,<br />
Dan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-128</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Mon, 22 Jun 2009 15:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-128</guid>
		<description>Naveen,

I have a LINQ statement working with multiple joins.  It returns the detailed results.  My problem lies after the statement has run.  I am trying to run a &quot;.Sum&quot; on the query results and it fails stating - Overload resolution failed because not accessible &#039;SUM&#039; accepts this number of arguments.  

What am I missing?

Thanks,
Dan

Dim Query = From TC In objTimeWorkedLinq.SA_Timeclocks 
Group Join JC In objTimeWorkedLinq.Job_Cds 
On TC.Job_Code Equals JC.Job_Code
Into loj1 = Group 
From TC1 In loj1.DefaultIfEmpty 
Group Join JCT In objTimeWorkedLinq.Job_Type_Cds 
On TC1.Job_Type_Code Equals JCT.Job_Type_Code 
Into loj2 = Group 
From TC2 In loj2.DefaultIfEmpty 
Where (p_intAssociateUID = -1 
OrElse TC.Associate_UID = p_intAssociateUID) 
And (p_intStoreUID = -1 
OrElse TC.Store_UID = p_intStoreUID) 
And TC.Date_Time &gt;= p_datStartDateTime 
And TC.Date_Time &lt;= p_datEndDateTime 
And (TC2.Include_Hours_Ind = &quot;Y&quot; Or TC2.Include_Hours_Ind Is Nothing) 
Select New With {.Productive_Hours_Qty = TC.Productive_Hours_Qty}

totalHours = Query.SUM</description>
		<content:encoded><![CDATA[<p>Naveen,</p>
<p>I have a LINQ statement working with multiple joins.  It returns the detailed results.  My problem lies after the statement has run.  I am trying to run a &#8220;.Sum&#8221; on the query results and it fails stating &#8211; Overload resolution failed because not accessible &#8216;SUM&#8217; accepts this number of arguments.  </p>
<p>What am I missing?</p>
<p>Thanks,<br />
Dan</p>
<p>Dim Query = From TC In objTimeWorkedLinq.SA_Timeclocks<br />
Group Join JC In objTimeWorkedLinq.Job_Cds<br />
On TC.Job_Code Equals JC.Job_Code<br />
Into loj1 = Group<br />
From TC1 In loj1.DefaultIfEmpty<br />
Group Join JCT In objTimeWorkedLinq.Job_Type_Cds<br />
On TC1.Job_Type_Code Equals JCT.Job_Type_Code<br />
Into loj2 = Group<br />
From TC2 In loj2.DefaultIfEmpty<br />
Where (p_intAssociateUID = -1<br />
OrElse TC.Associate_UID = p_intAssociateUID)<br />
And (p_intStoreUID = -1<br />
OrElse TC.Store_UID = p_intStoreUID)<br />
And TC.Date_Time &gt;= p_datStartDateTime<br />
And TC.Date_Time &lt;= p_datEndDateTime<br />
And (TC2.Include_Hours_Ind = &quot;Y&quot; Or TC2.Include_Hours_Ind Is Nothing)<br />
Select New With {.Productive_Hours_Qty = TC.Productive_Hours_Qty}</p>
<p>totalHours = Query.SUM</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codingsense</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-122</link>
		<dc:creator>codingsense</dc:creator>
		<pubDate>Tue, 16 Jun 2009 05:23:09 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-122</guid>
		<description>Hi Sheir,

Yes, the similar type of implementation is used for Multiple List joining. First join the 2 list and the output of it is joined with the 3ed one and so on. Here is one post for your reference 
&lt;a href=&quot;http://codingsense.wordpress.com/2009/06/16/multiple-list-left-join-in-linq/&quot; rel=&quot;nofollow&quot;&gt;Multiple List Join Using LINQ&lt;/a&gt;

Thanks,
Naveen Prabhu</description>
		<content:encoded><![CDATA[<p>Hi Sheir,</p>
<p>Yes, the similar type of implementation is used for Multiple List joining. First join the 2 list and the output of it is joined with the 3ed one and so on. Here is one post for your reference<br />
<a href="http://codingsense.wordpress.com/2009/06/16/multiple-list-left-join-in-linq/" rel="nofollow">Multiple List Join Using LINQ</a></p>
<p>Thanks,<br />
Naveen Prabhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheir</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-119</link>
		<dc:creator>Sheir</dc:creator>
		<pubDate>Fri, 12 Jun 2009 18:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-119</guid>
		<description>Thanks for the reply.

I had figured out the non-string null issue.
As an example:

select new                            
{
      RegisterDate = (employee != null) ? employee.RegisterDate : (DateTime?) null,
     EmployeeId = (employee != null) ? employee.EmployeeId : (int?) null
};

But i do not think that there is a &quot;left join&quot; in the Linq syntax so am not sure your multiple joining example would work.

What I ended up doing was using several &quot;var&quot; variables to get the multiple left join done; using the previous &quot;var&quot; in the new &quot;var&quot;.
As an example:

var lnqLeftJoin1 = 
from aRow in TableA
join bRow in TableB
	on aRow.Bid equals bRow.Bid
	into LeftJoinGroup
from grpRow in LeftJoinGroup.DefaultIfEmpty()
select new
{
	aRow.Aid,
	aRow.Bid,
        aRow.Cid, 
	BAddressId = (grpRow != null) ? 
		grpRow.AddressId 
		: (int?)null
};

var lnqLeftJoin2 = 
from ljRow in lnqLeftJoin1 
join cRow in TableC
	on ljRow.Cid equals cRow.Cid
	into LeftJoinGroup
from grpRow in LeftJoinGroup.DefaultIfEmpty()
select new
{
	ljRow.Aid,
	ljRow.Bid,
        ljRow.Cid,
        ljRow.BAddressId,
	OrderId = (grpRow != null) ? 
		grpRow.OrderId 
		: (int?)null,
	OrderDate = (grpRow != null) ? 
		grpRow.OrderDate 
		: (DateTime?)null,
};


That seem to work but am not sure if its the best way to handle multiple left join scenario.</description>
		<content:encoded><![CDATA[<p>Thanks for the reply.</p>
<p>I had figured out the non-string null issue.<br />
As an example:</p>
<p>select new<br />
{<br />
      RegisterDate = (employee != null) ? employee.RegisterDate : (DateTime?) null,<br />
     EmployeeId = (employee != null) ? employee.EmployeeId : (int?) null<br />
};</p>
<p>But i do not think that there is a &#8220;left join&#8221; in the Linq syntax so am not sure your multiple joining example would work.</p>
<p>What I ended up doing was using several &#8220;var&#8221; variables to get the multiple left join done; using the previous &#8220;var&#8221; in the new &#8220;var&#8221;.<br />
As an example:</p>
<p>var lnqLeftJoin1 =<br />
from aRow in TableA<br />
join bRow in TableB<br />
	on aRow.Bid equals bRow.Bid<br />
	into LeftJoinGroup<br />
from grpRow in LeftJoinGroup.DefaultIfEmpty()<br />
select new<br />
{<br />
	aRow.Aid,<br />
	aRow.Bid,<br />
        aRow.Cid,<br />
	BAddressId = (grpRow != null) ?<br />
		grpRow.AddressId<br />
		: (int?)null<br />
};</p>
<p>var lnqLeftJoin2 =<br />
from ljRow in lnqLeftJoin1<br />
join cRow in TableC<br />
	on ljRow.Cid equals cRow.Cid<br />
	into LeftJoinGroup<br />
from grpRow in LeftJoinGroup.DefaultIfEmpty()<br />
select new<br />
{<br />
	ljRow.Aid,<br />
	ljRow.Bid,<br />
        ljRow.Cid,<br />
        ljRow.BAddressId,<br />
	OrderId = (grpRow != null) ?<br />
		grpRow.OrderId<br />
		: (int?)null,<br />
	OrderDate = (grpRow != null) ?<br />
		grpRow.OrderDate<br />
		: (DateTime?)null,<br />
};</p>
<p>That seem to work but am not sure if its the best way to handle multiple left join scenario.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codingsense</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-118</link>
		<dc:creator>codingsense</dc:creator>
		<pubDate>Fri, 12 Jun 2009 04:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-118</guid>
		<description>Hi Sheir,

In my example i wanted the department name as output so i m taking &quot;null&quot; if no department exists, &quot;null&quot; is the default value of the department name i.e string. 

Similarly if you want int output then 
1) you can either use 0 in place of null as default value. 
2) or you can make the ID field in the department class and nullable int and use the same code.
public int&lt;strong&gt;?&lt;/strong&gt; ID { get; set; }

And for multiple joining, here is the syntax
FROM (A LEFT JOIN B ON A.id = B.id)
LEFT JOIN C ON A.id = C.id;

Hope your doubts are clear, if not feel free to ask :).
Thanks,
Naveen Prabhu</description>
		<content:encoded><![CDATA[<p>Hi Sheir,</p>
<p>In my example i wanted the department name as output so i m taking &#8220;null&#8221; if no department exists, &#8220;null&#8221; is the default value of the department name i.e string. </p>
<p>Similarly if you want int output then<br />
1) you can either use 0 in place of null as default value.<br />
2) or you can make the ID field in the department class and nullable int and use the same code.<br />
public int<strong>?</strong> ID { get; set; }</p>
<p>And for multiple joining, here is the syntax<br />
FROM (A LEFT JOIN B ON A.id = B.id)<br />
LEFT JOIN C ON A.id = C.id;</p>
<p>Hope your doubts are clear, if not feel free to ask <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
Thanks,<br />
Naveen Prabhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheir</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-117</link>
		<dc:creator>Sheir</dc:creator>
		<pubDate>Thu, 11 Jun 2009 22:02:24 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-117</guid>
		<description>Hi,
I am trying to do a Left Join following your example on my typed dataset have a couple problems I hope you can help me solve.

1) I need to do 3 left join operators between various tables

2) In your Select New clause for the child record which might be null, you do something like
DepartmentName = dept != null ? dept.Name : null

How do I code that if the child property is not a string but an int?  
As an example:
  DepartmentID = dept != null ? dept.Id : null

does not work.


Thanks for any help.
Sheir</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am trying to do a Left Join following your example on my typed dataset have a couple problems I hope you can help me solve.</p>
<p>1) I need to do 3 left join operators between various tables</p>
<p>2) In your Select New clause for the child record which might be null, you do something like<br />
DepartmentName = dept != null ? dept.Name : null</p>
<p>How do I code that if the child property is not a string but an int?<br />
As an example:<br />
  DepartmentID = dept != null ? dept.Id : null</p>
<p>does not work.</p>
<p>Thanks for any help.<br />
Sheir</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: codingsense</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-112</link>
		<dc:creator>codingsense</dc:creator>
		<pubDate>Mon, 11 May 2009 10:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-112</guid>
		<description>Hi Kanti,

Yes you can do it. Using &lt;strong&gt;Union&lt;/strong&gt; will help you achieve the result.

If you have 3 lists, List1 , list2 and list3 and if you want list2 in first and list3 in last then use,

var Result = List2.Union(List1).Union(List3)

The result will have what is required.

Thanks,
Naveen Prabhu</description>
		<content:encoded><![CDATA[<p>Hi Kanti,</p>
<p>Yes you can do it. Using <strong>Union</strong> will help you achieve the result.</p>
<p>If you have 3 lists, List1 , list2 and list3 and if you want list2 in first and list3 in last then use,</p>
<p>var Result = List2.Union(List1).Union(List3)</p>
<p>The result will have what is required.</p>
<p>Thanks,<br />
Naveen Prabhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kantimaya</title>
		<link>http://codingsense.wordpress.com/2009/03/08/left-join-right-join-using-linq/#comment-111</link>
		<dc:creator>Kantimaya</dc:creator>
		<pubDate>Mon, 11 May 2009 05:51:06 +0000</pubDate>
		<guid isPermaLink="false">http://codingsense.wordpress.com/2009/03/13/left-join-right-join-using-linq/#comment-111</guid>
		<description>Hi,
I have two lists on which i am applying linq to get my result as ID,Particulars,amount and date in the result.
Now i want to add two more records,one in the begining as  ID,&#039;My Particulars&#039;,amount,&#039;My date&#039; and same one in the last of the result.Is there any solution for this?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I have two lists on which i am applying linq to get my result as ID,Particulars,amount and date in the result.<br />
Now i want to add two more records,one in the begining as  ID,&#8217;My Particulars&#8217;,amount,&#8217;My date&#8217; and same one in the last of the result.Is there any solution for this?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
