Skip to content
Advertisement

How to redesign the table? Like recursive CTE

Due to the limited support of Bigquery for recursive CTE, I only have to use some silly ways to deal with the problem. My question is that I have a table below:

which indicates that B supervises A, and A supervises C.

I would like to have my table like this:

I have no idea how to change the table.

Can anyone help? Thanks!

Advertisement

Answer

Below example is for BigQuery Standard SQL

with result

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