I have a table called Orders
which looks like this:
Order_id Integer Ex: 10618834, 10618835
Customer_id Integer Ex: 231, 234
Order_Timestamp Date Ex: 10/25/2016 12:30:00 PM, 10/21/2016 2:32:31 PM
Order_status Varchar Ex: Success, Failure
I want to write the queries for these questions:
write a SQL query to get the week on week count of distinct users, count of successful orders for last 6 weeks.
write a SQL query to get the count of distinct users, who made their first successful order in April 2016 and made their 2nd successful order within 30 days from their first order date