Skip to content
Advertisement

Is there an other way to add calculated information to a table?

I have a table on BigQuery with some information and need to create another table with aggregated information by name with columns that have values with some condition.

Here is an example of a table:

Here is simple aggregate by name:

Output:

And needs add one more column “f_order_value” which has value from column “VALUE”, when f_order=order_id:

So try create virtual table and works with it, but it doesnt work due to i don’t use any aggragations in code, also I do not fully understand how to use the virtual table:

Error:

Star expansion expression references column site which is neither grouped nor aggregated at

Advertisement

Answer

I would go with (for BigQuery Standard SQL)

if to apply to sample data from your question – result is

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