原始存的是ip status 次数,status是成功或者失败,想达到的是统计一个ip的成功和失败次数,在一行里面显示
| | 王双利 | | 邮箱:[email protected] | 签名由 网易邮箱大师 定制 在2020年04月26日 18:14,王双利 写道: 看到的例子,都是 对单行数据进行转行的,这种多行数据的,有相关例子吗? 发件人: Benchao Li 发送时间: 2020-04-26 17:31 收件人: user-zh 主题: Re: sql 行转列 Hi 双利, 在Flink里面行转列用的是Table Function,你可以参考下[1] 里面的 ”Join with Table Function (UDTF)“ 部分。 [1] https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/queries.html#joins 王双利 <[email protected]> 于2020年4月26日周日 下午5:19写道: > select ip, > case status when 'success' THEN sum(t) ELSE 0 end successct, > case status when 'fail' THEN sum(t) ELSE 0 end failct > from view1 > group by ip 这样不能行转列,有解决方案吗? > > > -- Benchao Li School of Electronics Engineering and Computer Science, Peking University Tel:+86-15650713730 Email: [email protected]; [email protected]
