FetchXML相关问题

本文讨论了FetchXML中属性值的问题,特别是当属性与外层属性重合时,如何利用alias属性(相当于SQL的别名)进行区分和访问。通过别名,可以有效地在查询时指定正确的字段。
<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-entityifeng_ordertypeidto属性是外层entityifeng_ordertypeid
由于entity中的属性与link-entity中的属性有重合,所以要依靠link-entity的alias属性(对应SQL语句中的别名),访问的时候可以根据别名来访问。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值