栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

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

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

*

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

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

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



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/614527.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号