View difference between Paste ID: uDK6wNnc and whfUVVsY
SHOW: | | - or go back to the newest paste.
1
SELECT 
2-
    EXTRACT (week FROM subq.trunc_date) AS week_number,
2+
	COUNT (DISTINCT id_transaction) AS transaction_per_day,
3-
    AVG(subq.transaction_per_day) AS avg_week_transaction
3+
    DATE_TRUNC('day', date) AS trunc_date
4-
FROM	
4+
FROM
5-
    (SELECT  
5+
	transactions
6-
		COUNT(distinct id_transaction) as transaction_per_day,
6+
7-
		DATE_TRUNC('day', date) AS trunc_date
7+
    trunc_date