I am very new to SQL and have a relatively complex query to write, any help would be appreciated.
I have data with the following columns:
ORDER_ID CUST_ID ORDER_DATE RETURNED(1/0)
I need a table with the following three columns:
A column with the count of the number of orders a specific customer had before their FIRST returned order.
A column with the count of number of orders a specific customer had after their FIRST returned order.
Each order has a unique id as does each customer, but there are many customers who had multiple orders at different dates. Not all customers had returned orders and I just need the counts for the customers who had a returned order (