Skip to content
Advertisement

Split a single sql column into five

I’m trying to split one column into up to five around the ” > ” delimiter but the things I’ve tried haven’tw orked:

I tried

which didn’t work, and

this which sort of did (the first part anyway, not the nth part)

I’ve found lots of examples on here but they all seem to be saying to use the brackets but the brackets throw an error:

Exception: Malformed SQL. More information: Error with SQL statement: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘[1] as “first” from table where compoundColumn IS NOT NULL’ at line 3.

Advertisement

Answer

I finally got where I needed to go using regexp extract, in the bigquery pull rather than within appmaker:

The +”>” part of the code is ugly but I couldn’t get it to match strings that didn’t end with the bracket (“>?” breaks the whole thing) so I just made them all end with the bracket.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement