Skip to content

Commit

Permalink
Create short_cte.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
kdyl committed Feb 11, 2022
1 parent cdc3cb6 commit 992570b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions short_cte.sql
@@ -0,0 +1,11 @@
WITH table_with_count_products AS (
SELECT transaction_id
, month
, count(product_id) AS count_products
FROM transactions
GROUP BY transaction_id, month
)
SELECT month
, avg(count_products) AS average_product_count
FROM table_with_count_products
GROUP BY month

0 comments on commit 992570b

Please sign in to comment.