Active Subscription Order
Step 2: for each active subscription with status = 'active', assign its sequence number within its user_id: the earliest started_at gets 1, and a tie uses the smaller id first. Return id, user_id, and rn, sorted by user_id, then rn.
Esempio di output atteso
Ecco come appare una risposta corretta — il suo numero di righe è a sé stante, non deve corrispondere alle tabelle dello schema.
| id | rn | user_id |
|---|---|---|
| 300 | 1 | 1 |
| 301 | 2 | 1 |
| 302 | 1 | 2 |
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
Accedi