Menu
mediumU Mobile · window

Number each subscriber's reloads in order

Prepaid reloads all land in one table. Marketing wants to know whether a reload was a subscriber's first, second, third and so on, so they can target people who have only ever reloaded once.

Number each subscriber's reloads from oldest to newest, restarting at 1 for every subscriber.

Return msisdn, reload_date, amount and reload_no, ordered by msisdn then reload_date.

Schema

reloads
reload_idINT
msisdnTEXT
reload_dateDATE
amountNUMERIC

Example input

reloads
↑ Read the question

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.