这是我的代码:
SELECT rule,
DATASET,
type,
LISTAGG(source,';') within GROUP (ORDER BY source) AS source,
TARGET,
LISTAGG(filter,';') within GROUP (ORDER BY filter) AS filter
FROM demo_table;
Run Code Online (Sandbox Code Playgroud)
我的问题是使用的两个listagg()。如果有两个来源和一个过滤器,则给出重复的过滤器,反之亦然。我可以添加什么以仅具有确切数目的源和过滤器?