on 11-14-2014 12:44 PM
Hi,
In my table I have rows like this
Table Name : Test
Name
-----------------------
sam
khan
sun
sam
My query
Select string_agg(Name,',') from Test
Output
sam,khan,sun,sam
But it is giving Duplicate values like sam comes twice.
Please help me to Eliminate duplicates while using string_agg function
You might be successful if you tell SAP HANA that you want the duplicates to be eliminated.
select string_agg_name,',') from
( select distinct name from test
)
You might be careful though when your inner select contains an aggregation already. Then the SAP HANA optimizer can find the DISTINCT to be disposable...
But that's problem to deal with when you face it
- Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.