select c.id, c.fname, c.lname, d.phoneList
from customers c
left outer join
(
select listagg(telNo, ',') within group (order by telNo) as phoneList
from customerPhones
group by p.telNo
) d
on (c.id = d.id)
在上述查询中,我在语句中收到以下错误c.id = d.id
ORA-00904 "d.id" invalid identifier.
它仅在我将其包含在 select 语句中并且需要将其包含在 group by 语句中的含义中才有效。有什么方法可以使用 d.id 而不必将其包含在 group by 语句中?