重命名所有列名称以在大型查询中加入

重命名所有列名称以在大型查询中加入,第1张

重命名所有列名称以在大型查询中加入

*

SELECt inv.*, prof.*
显然,最终
Duplicate column names in the result are notsupported. ...
*使用
SELECT inv, prof
如下所示, 而不是 最终 使用

#standardSQLWITH inv AS (  SELECT'001' AS company,'abc' AS vendor,800.00 AS transaction,'inv' AS type UNIOn ALL  SELECT'002' AS company,'efg' AS vendor,23.4 AS transaction,'inv' AS type ), prof AS (  SELECT'001' AS company,'abc' AS vendor,800.00 AS transaction,'prof' AS type UNIOn ALL  SELECT'002' AS company,'efg' AS vendor,23.4 AS transaction,'prof' AS type )SELECT inv, profFROM inv FULL JOIN profUSING (company, vendor, transaction)

结果 :

Row inv.company inv.vendor  inv.transaction inv.type    prof.company    prof.vendor prof.transaction    prof.type    1     001abc         800.0  inv         001  abc800.0    prof     2     002efg         23.4   inv         002  efg23.4     prof

如您所见,结果行现在具有两个结构/记录-每个都包含来自相应表的相应条目

我认为,从所有实际原因出发,这是您最好的选择



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5620626.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存