Search code examples
splitgoogle-bigquerycross-apply

How to use SPLIT and CROSS APPLY functions in BigQuery


I'm struggling with the split and cross apply functions in BigQuery. However it didn't work. If anyone can help that will help me a lot in my project. Thanks! I want the output looks like this:

The output I want


Solution

  • Try UNNEST:

    select deptid, deptname, value
    from mytable, unnest(split(deptlocation)) as value