Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cust_name,sales_count,day_count
- cust_a,100,3
- cust_a,200,5
- cust_a,150,7
- cust_a,120,1
- cust_a,180,10
- cust_a,100,8
- cust_b,20,3
- cust_b,10,4
- cust_b,50,6
- cust_b,60,8
- cust_b,15,9
- cust_name,sales_count,day_count
- cust_a,280,last_14
- cust_a,450,last_7
- cust_b,85,last_14
- cust_b,80,last_7
- select cust_name,
- sum(case when day_count > 7 then count(sales_count) else 0 end) as count_14,
- sum(case when day_count < 7 then count(pendo_visitor_id) else 0 end) as count_7
- from sales
- group by cust_name;
Add Comment
Please, Sign In to add comment