开发者社区> 问答> 正文

odps 不支持多表联合查询吗?

odps 不支持多表联合查询吗?
如:
select a.xx,, b.xx, c.xx from tb _tmp a ,tb _tmp2 b ,
tb_tmp3 c where a.id=b.id=c.id
是否只能改用 join ?
请问如何改?
可否提供一些多表联合查询的例子?谢谢!

展开
收起
琴瑟 2017-05-31 16:42:00 7918 0
2 条回答
写回答
取消 提交回答
  • 别写成a.id=b.id=c.id

    2019-07-17 21:14:22
    赞同 展开评论 打赏
  • TA有点害羞,没有介绍自己...

    odps 支持多表关联操作,但是不支持 join 笛卡尔积关联。
    支持left outer join (左连)等关联。
    具体的方法和例子,您可以参考
    https://help.aliyun.com/document_detail/48950.html中下方关联。大体的sql关联逻辑不是odps特有,和标准sql类似。您的这个逻辑大致可以如下
    select a.xx, b.xx, c.xx
    from tb_tmp a
    left outer join tb _tmp2 b on a.id=b.id
    left outer join tb _tmp3 c on b.id=c.id and a.id=c.id

    2019-07-17 21:14:22
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
大数据AI一体化的解读 立即下载
极氪大数据 Serverless 应用实践 立即下载
大数据&AI实战派 第2期 立即下载