2017-02-23 37 views
0

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

使用下面的查询,我得到多行按客户:

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

但我想有一个领域同时与客户经理和区域。这个怎么做?

回答

0

使用组功能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