<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="ifeng_contracts">
<attribute name="ifeng_contractsid" />
<attribute name="ifeng_name" />
<attribute name="createdon" />
<order attribute="ifeng_name" descending="false" />
<filter type="and">
<condition attribute="ifeng_source" operator="eq" value="20" />
<condition attribute="ifeng_paytype" operator="in">
<value>1</value>
<value>2</value>
<value>3</value>
</condition>
</filter>
<link-entity name="ifeng_ordertype" from="ifeng_ordertypeid" to="ifeng_ordertypeid" alias="ac">
<filter type="and">
<condition attribute="ifeng_name" operator="not-null" />
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</link-entity>
</entity>
</fetch>
<link-entity>标签的from属性的值是link-entity的ifeng_ordertypeid和to属性是外层entity的ifeng_ordertypeid。
由于entity中的属性与link-entity中的属性有重合,所以要依靠link-entity的alias属性(对应SQL语句中的别名),访问的时候可以根据别名来访问。
本文讨论了FetchXML中属性值的问题,特别是当属性与外层属性重合时,如何利用alias属性(相当于SQL的别名)进行区分和访问。通过别名,可以有效地在查询时指定正确的字段。

798

被折叠的 条评论
为什么被折叠?



