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?

4
  • Which dbms are you using? Commented Nov 14, 2019 at 9:50
  • I'm using MYSQL for dbms Commented Nov 14, 2019 at 10:20
  • I've removed the phpmyadmin tag because this doesn't seem to have anything to do with the phpMyAdmin application. Commented Nov 19, 2019 at 19:49
  • Possible duplicate of UNNEST function in MYSQL like POSTGRESQL Commented Nov 19, 2019 at 20:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.