0

I want to try to change my array into string and transpose it exactly like this thread about converting-array-of-strings-to-single-row-values but I failed when trying to implement it.

my array have some data like:

Claimers = ["140","119","120","121","122","123","126","127"]
userId = ["1","2","3","4"]

the length itself is around 60, I try to use UNNEST and concat_ws but still failed

this is my query when using UNNEST:

SELECT `Code`, `Used`, `Claimers` AS aClaim FROM referal, UNNEST(aClaim) aClaim

and this is my query when using concat_ws:

SELECT `Code`, `Used`, concat_ws(',', `Claimers`) AS aClaim FROM referal

I want my output look like this:

1 140
1 119
2 120
2 122
2 123
3 121
3 126
4 127

can someone help me to tell where I failed to implement the technique?

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Rakish Frisky
  • 665
  • 7
  • 23

0 Answers0