{"id":797,"date":"2010-07-07T02:04:00","date_gmt":"2010-07-07T02:04:00","guid":{"rendered":"http:\/\/mooredynasty.net\/?p=797"},"modified":"2014-12-18T23:05:07","modified_gmt":"2014-12-18T23:05:07","slug":"linq-and-a-multi-column-join-problem","status":"publish","type":"post","link":"https:\/\/mooredynasty.net\/index.php\/2010\/07\/linq-and-a-multi-column-join-problem\/","title":{"rendered":"LINQ and a Multi-column Join Problem"},"content":{"rendered":"<p>What causes the following LINQ query to generate a &quot;The type of one of the expressions in the join clause is incorrect.&#160; Type inference failed in the call to &#8216;Join&#8217;&quot; error?<\/p>\n<blockquote>\n<p>from doc in BvdDoc     <br \/>join job in BvdJob on doc.BvdDocID equals job.BvdDocID      <br \/>join iter in BvdIteration on job.BvdJobID equals iter.BvdJobID      <br \/>join mbr in VMember on doc.Adloc.Substring(0, 2) equals mbr.MbrID      <br \/>join ttl in VTitleCode on new { mbr.WrkStn, iter.TitleCode } equals new { ttl.PayPlan, ttl.TitleCode }      <br \/>select new {      <br \/>&#160;&#160;&#160; doc.BvdDocID,       <br \/>&#160;&#160;&#160; doc.Adloc,       <br \/>&#160;&#160;&#160; job.BvdJobID,       <br \/>&#160;&#160;&#160; iter.BvdIterationID,       <br \/>&#160;&#160;&#160; iter.TitleCode,      <br \/>&#160;&#160;&#160; mbr.MbrID      <br \/>}<\/p>\n<\/blockquote>\n<p>Answer: The anonymous types created on the join to the title code view must have matching property names, as in:<\/p>\n<blockquote>\n<p>join ttl in VTitleCode on new { Workstation = mbr.WrkStn, iter.TitleCode } equals new { Workstation = ttl.PayPlan, ttl.TitleCode } <\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>What causes the following LINQ query to generate a &quot;The type of one of the expressions in the join clause is incorrect.&#160; Type inference failed in the call to &#8216;Join&#8217;&quot; error? from doc in BvdDoc join job in BvdJob on doc.BvdDocID equals job.BvdDocID join iter in BvdIteration on job.BvdJobID equals &hellip; <\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-797","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/comments?post=797"}],"version-history":[{"count":1,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/797\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/posts\/797\/revisions\/798"}],"wp:attachment":[{"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/media?parent=797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/categories?post=797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mooredynasty.net\/index.php\/wp-json\/wp\/v2\/tags?post=797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}