Question

Locked

Combining some items within an aggregated list in SQL

By john.a.wills ·
Tags: Software
I have this column in an SQL query (within Argos, but that is perhaps not germane):
ListAgg (high.SPRTELE_PHONE_AREA || high.SPRTELE_PHONE_NUMBER || '||'
|| case high.SPRTELE_TELE_CODE when 'HM' then '2'
when 'CE' then '2'
when 'TX' then '1'
else
'mistake'
end
|| '|' || nvl (high.SPRTELE_CTRY_CODE_PHONE, '1')
|| '|' || STVTELE.STVTELE_DESC, ';') within group (order by sprtele_ctry_code_phone, sprtele_phone_area, sprtele_phone_number)
It gives me a list of telephone numbers with related data for each number. When the _tele_code handling yields a '1' and a '2' for the same telephone number I want to have only one item in the list with value '3'. How do I set about this? Do I have to nest ListAgg in some way? Or is there a less scruffy solution?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums