on 12-18-2015 1:54 PM
Hi,
I have a table with two columns. CustomerID and AccountManager.
Most customers have just one account manager. Some have two or more.
I need to query the table, returning one row per CustomerID, with the AccountManager. For the customers with more than one account manager, I need to return a comma separated list of account managers.
e.g.
Customer table:
Query result:
I need the query result as a view for further use.
Can anyone give me a tip, without using a Cursor?
Thanks in advance,
Rob
You can use STRING_AGG to achieve this
SAP HANA Academy - SQL Functions: String_Agg - YouTube
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.