你可以通过 groupby collect 来将一对多的关系聚合起来,代码类似如下:

select userId, collect(userBankTime)
from (
  select  userId, concat(userBankNo, '_', createTime) as userBankTime
  from aa as a left join bb as b where a.userId=b.userId
) group by userId;


Best,
Jark

On Mon, 21 Sep 2020 at 12:20, Li,Qian(DXM,PB) <[email protected]> wrote:

> 请问:
>
> 我在使用Flink CDC SQL CLI的时候,想将关联的两张表的一对多关系
> 映射成ARRAY[ROW(userBankNo,createTime)]的形式,要怎么映射呢?
>   表aa
>   id, userId
>   表 bb
>   userId,userBankNo,createTime
>
> select  * from aa as a left join bb as b where a.userId=b.userId
>
> 谢谢!
>
>

回复