A Combined Activity Timeline

medium
Unit 19 · Union0/2 to milestone

Build one timeline of signups and orders. Return event_date, customer_id, event ('signup' or 'order') and amount (NULL for signups, the order total for orders).

Sort by event_date, then with signups before orders on the same date, then by customer_id.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#union#events1 visible + 1 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
A Combined Activity Timeline · TechGradify