X++中的Join

  1. InnerJoin(内连接):
    –组合数据源 – 从主表中根据条件选择与连接表中的记录相匹配的记录,反之亦然。
    例:
    select AccountNum from custTable
    join TaxGroupId from custGroup
    where custGroup.CustGroup == custTable.CustGroup;

  2. Outer Join(外连接),
    –组合数据源 – 从主表中选择记录。无论在连接表中是否有匹配的记录,都会检索这些记录。
    select AccountNum from custTable
    outer join AccountID from custBankAccount
    where custBankAccount.CustAccount == custTable.AccountNum;

  3. Exists Join:

    • 数据源从主表中为连接表中的每个匹配记录检索一条记录。
      InnerJoin 和 ExistJoin 的区别如下:
      · 当连接类型为 ExistJoin 时,搜索在找到第一个匹配项后结束。
      · 当连接类型为InnerJoin 时,搜索所有匹配的记录。
      如果在执行 join 子句后结果集中有任何记录,则返回 true。否则返回 false。
      例:
      select AccountNum from custBankAccount
      exists join custTable
      where custBankAccount.CustAccount == custTable.AccountNum;
  4. NotExists Join: –组合数据源-从主表中选择在连接表中没有匹配项的记录。
    如果在执行 join 子句后结果集中有任何记录,则返回 false。否则返回真。
    例:
    select AccountNum from custBankAccount
    notexists join custTable
    where custBankAccount.CustAccount == custTable.AccountNum;
    参考博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值