New answers tagged


Okay, had to do this in three steps: To mark which records we want to keep (first record for each customer, records where the status changed) To get the prior row's stream_datetime and calculate the the difference between Select only the rows where the order_status was 'cancelled'. SELECT customer_id ,purchase_day ,lifetime FROM ( SELECT ...

Top 50 recent answers are included