迁移后左联接多个表

时间:2019-11-27 00:52:08

标签: sql sql-server sql-server-2016

我这里有一个存储过程,我们已迁移到SQL Server 2016,因此需要更新以前版本中的某些命令。但是我在某些命令中遇到了麻烦,因为它显示了错误。下面是我的示例代码。

if @stat = '%' 
   DECLARE onground_cur CURSOR for
   SELECT pkgh_type, pkgd_date, pkgd_area, pkgd_intcost, pkgd_billcost, pkgh_advcde,
      pkgh_agencde, pkgh_refno, pkgd_ae, pkgd_currency, bs_invno, bs_exinvno, pkgd_cpno
   FROM pckg_hdr, pckg_dtl, bill_sked
   WHERE pkgh_refno = pkgd_refno
      and pkgh_type in ('C', 'X')
      and pkgd_date between @dtfrom and @dtto
      and (pkgd_stat = 'I' or pkgd_stat = 'A')
      and pkgd_area like ltrim(@s_area)
      and pkgd_currency like ltrim(@p_currency)
      and pkgh_agencde like ltrim(@s_agency)
      and pkgh_advcde like ltrim(@s_advertiser)
      and pkgh_refno *= bs_pkgrefno
      and pkgd_dtlno *= bs_pckgdtlno

我需要更新的部分是那些带有“ * =”符号的人:

**pkgh_refno *= bs_pkgrefno and pkgd_dtlno *= bs_pckgdtlno**

我所做的是:

**pckg_hdr left join bill_sked on pkgh_refno**

但是当我尝试另一个pkgd_dtlno *= bs_pckgdtlno

我无法执行代码了。另外,我在使用左联接和右联接时遇到麻烦。

(spd_invno *= invh_invno and invh_invtp =* ordh_conttp)

1 个答案:

答案 0 :(得分:0)

Linking /usr/local/Cellar/node/13.2.0... Error: Could not symlink include/node/common.gypi /usr/local/include/node is not writable. 在今天的*=中已不再supported,请改用sql server versions

left outer join