Skip to content
Advertisement

BigQuery – Scalar subquery produced more than one element –

I have this query that helps me to find separate key words within strings (very useful with utm_campaign and utm_content):

For example: if I have a umt_campaign like this:

us_latam_mkt_google_black-friday_audiencie-custom_NNN-NNN_nnn_trafic_responsiv

The query from above will help me to separate each word with a _ in between. So I’ll have a result like this:

utm_campaign country product budget source campaign audience
us_latam_mkt_google_black-friday_audiencie-custom_NNN-NNN_nnn_trafic_responsiv us latam mkt google black-friday audience-custom
  • What I want from the query from above is to give me in this case the audience column. I tried to add the query from above as a sub-query on this query in REVENUE because in this table I don’t have the audience column but I have the utm_campaign column. Inside the utm_campaign string, the sixth fragment is the audience (with this query I have the error “Scalar subquery produced more than one element”):

What am I doing wrong here?

What I would like too see is having a match between the format dimension from COST and the format dimension from REVENUE (which it doesn’t exists, but it is within the campaign column).

Advertisement

Answer

You don’t really need the interior select statements as your campaign data should be in the same row of the table.

Change this:

to something like this:

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