Skip to content

Instantly share code, notes, and snippets.

@RatulSaha
Created May 2, 2018 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RatulSaha/2009ab5956163d247cac1240c3facba4 to your computer and use it in GitHub Desktop.
Save RatulSaha/2009ab5956163d247cac1240c3facba4 to your computer and use it in GitHub Desktop.
WITH query1 AS (
SELECT
'china' AS country_code,
origin,
ROUND(SUM(IF(fcp.start <=1000, fcp.density,0)) / SUM(fcp.density),5) AS SEB_native
FROM
`chrome-ux-report.country_cn.201712`,
UNNEST(first_contentful_paint.histogram.bin) AS fcp
WHERE
origin = 'https://www.amazon.cn'
GROUP BY
origin),
query2 AS (
SELECT
origin,
ROUND(SUM(IF(fcp.start <=1000, fcp.density,0)) / SUM(fcp.density),5) AS SEB_global
FROM
`chrome-ux-report.country_cn.201712`,
UNNEST(first_contentful_paint.histogram.bin) AS fcp
WHERE
origin = 'https://www.amazon.com'
GROUP BY
origin )
SELECT
country_code,
SEB_native,
SEB_global
FROM
query1,
query2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment