Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: How to concatenate rows into a single column in hana view

$
0
0

How would I use this to only return distinct values concatenated? I thought I could use distinct in a subquery and then use string_agg to query those values, but that doesn't work:

 

Select STRING_AGG(t0."SO", ',') "SO"

from (

SELECT distinct 1 "SO"

from [table name] t0) t0

 

If the table you're querying against only has 1 result it will only return 1. But in my case my table has multiple rows. So even though the subquery only returns one result, the whole query returns 1,1,1,1,1,etc.


Viewing all articles
Browse latest Browse all 9165

Trending Articles