2012-06-26 36 views
2

我試圖在fetchXML中建立2個左外連接。我可以完成這個SQL語句...如何在相同的2個實體之間完成fetchXML中的2個外連接?

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 

成一個fetchXML語句如此?

<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> 

回答

0

我認爲LINQtoCRM可以到這一點,你可能也戳周圍LinqPad

+1

不,LINQtoCRM不能進行外連接,只支持內連接。 – Gutek

相關問題