I am trying to use the SPLIT() function to convert an array of strings into individual rows.
The data looks something like this:
id ticket
1 1,2,3,4,5,6,7,8,9...etc.
2 11,12,13,14,15,16,17,18,19...etc.
3 21,22,23,24,25,26,27,28,29...etc.
I would want the data to look like this:
id ticket
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
2 11
2 12
2 13
2 14
2 15
2 16
...and so on. When I use the following:
SELECT id, SPLIT(ticket) FROM table
, I get exactly the result I want. The problem is, I have to join this table with another table which is partitioned and I cannot use legacy SQL. Because of the multiple tickets associated with each id (up to 200), typing out each one seems inefficient. The ticket numbers are also formatted as a string.
If anyone has a solution for this, it would be greatly appreciated!