0

我想检索客户名称列表以及使用自定义属性注册的已分配客户经理和区域列表。

使用以下查询,我得到每个客户多行:

select accountclassifications_account_name
,      property_code_attr
,      property_description
from   exactonlinexml..accountclassifications 
where  property_code_attr in ( 'BO', 'REGION' )

但我想在客户经理和地区都有一个字段。这个怎么做?

4

1 回答 1

0

使用 group 函数listagg,您可以检索每个客户帐户的多个值:

select accountclassifications_account_name
,      listagg(property_code_attr || ': ' || property_description) lst
from   exactonlinexml..accountclassifications 
where  property_code_attr in ( 'BO', 'REGION' )
group 
by     accountclassifications_account_name

当您需要不同的分隔符时,可以将其指定为单独的参数listagg

于 2017-02-23T15:16:11.730 回答