#1056

Subscriptions to Close

Step 3: for each user, keep the earliest active subscription with status = 'active' and mark all later active subscriptions as extras to close. Return the id values of those extra subscriptions, sorted by id.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

id
301

Your query result will appear here