cancel
Showing results for 
Search instead for 
Did you mean: 

hana sql query

0 Kudos

Hi experts,

I want to query some data and put it in the same row.

for ex. I have sales orders number 1 to 5 I want to put them in the same cell as that (1,2,3,4,5)

is that possible?

Accepted Solutions (1)

Accepted Solutions (1)

KonradZaleski
Active Contributor
0 Kudos

You can use STRING_AGG function to concatenate values. Here is an example:

CREATE LOCAL TEMPORARY TABLE #t1 ("ORDER" VARCHAR(10));

INSERT INTO  #t1 VALUES ('1');
INSERT INTO  #t1 VALUES ('2');
INSERT INTO  #t1 VALUES ('3');
INSERT INTO  #t1 VALUES ('4');
INSERT INTO  #t1 VALUES ('5');

SELECT STRING_AGG("ORDER",',') FROM #t1;

Answers (1)

Answers (1)

0 Kudos

Thank's Konrad STRING_AGG works with me

KonradZaleski
Active Contributor
0 Kudos

Then please accept the answer.