convert meine SQL-Abfrage zu queryexpression oder fetchxml in crm

Ich habe dasSQL Frage, wo ich versuche, das @ zu holopportunityId von Opportunity-Entität für wenapprovaldocument wurde nicht erstellt (Genehmigungsdokument ist der Name der anderen Entität). Ich glaube nicht, dass fetchxml solche Abfragen unterstützt. Ich bin neu bei crm und mein Projekt ist incrm 4.0 Ausführung

hier ist die SQL-Abfrage:

Select OpportunityId from opportunity AS c left JOIN (select a.opportunitynameid from opportunity o
JOIN ApprovalDocument a ON 
a.opportunitynameid=o.OpportunityId) AS b ON c.OpportunityId=b.opportunitynameid
Where b.opportunitynameid IS NULL and statecode=0

Ich habe dies in ein @ umgewandefetchxml, aber das gab nicht das richtige Ergebnis.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"> 
    <entity name="opportunity"> <attribute name="opportunityid" /> 
       <link-entity name="approvaldocument" from="opportunitynameid" to="opportunityid" alias="a" link-type="outer"> <attribute name="opportunitynameid" /> 
       </link-entity> 
       <filter type="and"> 
          <condition entityname="a" attribute="opportunitynameid" operator="null" /> 
       </filter> 
    </entity> 
<fetch/>

Antworten auf die Frage(2)

Ihre Antwort auf die Frage