2

I'm trying to establish 2 left outer joins in fetchXML. Can I accomplish this sql statement...

select
a.new_campaignid
, a.new_ContactId
, b.new_campaigncontactstatusId
from
new_ContactCampaignNN AS a 
    left outer join new_campaigncontactstatus AS b ON a.new_contactid = b.new_ContactId 
        AND a.new_campaignid = b.new_CampaignId

into a fetchXML statement such as this?

<fetch mapping='logical' distinct='true'>
  <entity name='new_contactcampaignnn'>
    <attribute name='new_campaignid' />
    <attribute name='new_contactid' />
    <filter type='and'>
      <condition attribute ='new_campaignid' operator='eq' value='72C9284B-905D-E111-9847-002655325864'/>
    </filter>
    <link-entity name='new_campaigncontactstatus' from='new_contactid' to='new_contactid' visible='true' link-type='outer' alias='new_contactcampaignnn_new_campaigncontactstatus'>
      <attribute name='new_campaigncontactstatusid' />
      <link-entity name='new_contactcampaignnn' from='new_campaignid' to='new_campaignid' visible='true' link-type='outer' alias='new_contactcampaignnn_new_campaigncontactstatus1'></link-entity>
    </link-entity>
  </entity>
</fetch>
maatthias
  • 137
  • 2
  • 12

1 Answers1

0

I think LINQtoCRM can to this and you can probably also poke around with LinqPad.

friism
  • 19,068
  • 5
  • 80
  • 116