Skip to content

Instantly share code, notes, and snippets.

@tuanchris
Last active September 2, 2022 02:54
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 tuanchris/2194a3d8012cb3f245d99ccbda570ac5 to your computer and use it in GitHub Desktop.
Save tuanchris/2194a3d8012cb3f245d99ccbda570ac5 to your computer and use it in GitHub Desktop.
fashionly_basic_query
SELECT
DATE(o.created_at) AS order_created_date,
SUM(oi.sale_price) AS revenue,
COUNT(DISTINCT o.order_id) AS order_count,
COUNT(DISTINCT o.user_id) AS customers_orderd
FROM
`bigquery-public-data.thelook_ecommerce.orders` o
LEFT JOIN
`bigquery-public-data.thelook_ecommerce.order_items` oi
ON
o.order_id = oi.order_id
WHERE
o.status NOT IN ('Cancelled',
'Returned')
GROUP BY
1
ORDER BY
1 desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment