Skip to content

Instantly share code, notes, and snippets.

@molavec
Last active April 2, 2019 18:33
Show Gist options
  • Save molavec/c462d23074d28ae2cd32730095484867 to your computer and use it in GitHub Desktop.
Save molavec/c462d23074d28ae2cd32730095484867 to your computer and use it in GitHub Desktop.
[bigquery - campo dentro de un arreglo struct] ejemplo para la consulta de un campo en dentro de una estructura #bigquery #sql
SELECT av.action_type, av.value
FROM
`[RUTA_PROYECTO].[RUTA_CONJUNTO_DE_DATOS].ads_insights`, unnest(actions) a, unnest(action_values) av
WHERE
av.action_type Like '%purchase%'
LIMIT 1000
CREATE VIEW `[RUTA_PROYECTO].[RUTA_CONJUNTO_DE_DATOS].convertion_type_view` AS
SELECT DISTINCT
a.action_type
FROM
`[RUTA_PROYECTO].[RUTA_CONJUNTO_DE_DATOS].ads_insights`, UNNEST(actions) AS a
WHERE
a.action_type Like '%lead%' OR a.action_type Like '%purchase%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment