Skip to content
Advertisement

Condition OFFSET on SPLIT in SQL

I am using SQL on Google Big Query.

I have a column MyColumn which value is in this format :

I need to fetch the value of T13 (“1” in this case).

The code I have done so far is this :

This code works if T13 is positioned the 3rd in the list. But I have values where it is not. For example :

Once I’ve done the SPLIT by “/”, how can I dynamically detect which position T13 is and fetch its value ? Is a dynamic OFFSET possible ?

Thank you

Advertisement

Answer

Use regexp_extract():

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