我对在 oracle 中查询非常陌生。我已经使用LISTAGG构建了一个 oracle 查询,如下所示:
select a.field1,
LISTAGG(d.field2, ';') WITHIN GROUP (ORDER BY d.field2) AS FIELD_ALIAS
from
table1 a, table2 b,
table4 c, table5 d
where
a.field2 = b.field2
and
b.field2 = c.field2
and
c.field3 = d.field3
group by
a.field1
返回:
field1 field2
----------------
504482 Labour;Labour;Labour;Labour;Labour;Labour;Labour;Labour
我想做的是简化第二个字段并删除冗余值,以便我得到:
field1 field2
----------------
504482 Labour
那可能吗?