【发布时间】:2020-06-03 14:51:57
【问题描述】:
我正在尝试构建与 SQL 查询等效的 FetchXML,我在使用 FetchXML 方面还很陌生:
SELECT o.opportunityid,c1.accountid
FROM dbo.opportunity o
LEFT JOIN dbo.account c1 on o.customerid = c1.accountid and o.customeridtype = 1
进入
<fetch mapping="logical" version="1.0">
<entity name="opportunity">
<attribute name="opportunityid" />
<link-entity name="account" from="accountid" to="customerid" alias="A1" link-type="outer" >
<filter type="and" >
<condition attribute="customeridtype" operator="eq" value="1" />
</filter>
<attribute name="accountid" />
</link-entity>
但这会引发错误,说明实体“account”中不存在属性“customeridtype”。该属性来自 SQL 查询中的机会实体。我该如何解决这个问题?
【问题讨论】:
-
解决了你的问题吗?
-
我无法在链接之外取出过滤器,因为它还有几个连接,并且该过滤器应该只应用于那个连接。但是,我已将实体单独下载到表中,并在 SQL 本身的连接中要求
-
这就是为什么你应该把完整的代码分享给我们:)
标签: sql-server dynamics-crm fetchxml kingswaysoft