ft_sessions (session_id, user_id, channel, started_at) records every visit and the marketing channel it came from; ft_purchases (purchase_id, user_id, purchased_at) records purchases.
Marketing credits each user to one channel: the channel of their first session, the one with the earliest started_at. When two of a user's sessions start at the same moment, the one with the smaller session_id came first.
For each channel, return:
- •
users — the users credited to it - •
purchasers — how many of those users made at least one purchase - •
conversion_pct — purchasers as a percentage of users, rounded to 1 decimal place
A channel that is nobody's first session doesn't appear.
Columns: channel, users, purchasers, conversion_pct. Sort by channel.