Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How do i do a left join using FetchXml?

Consider a simple SQL query like the following:

select person.name, address.city from person
left join address on person.addressid = address.addressid

How would something simple like this be done using FetchXml? Currently my FetchXml query looks like the following:

<fetch mapping='logical'>
  <entity name='person'>
    <attribute name='name' />
    <link-entity name='address' from='addressid' to='addressid'>
      <attribute name='city' />
    </link-entity>
  </entity>
</fetch>
share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

Update your <link-entity> like so:

<link-entity name='address' from='addressid' to='addressid' link-type='outer'>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.