Write a query to identify the top 3 merchants by transaction volume for each category in the last 30 days for Phonepe.
Use successful transactions only. The 30-day period includes today and the preceding 30 calendar days.
category_name, merchant_id, merchant_name, and transaction_volume.transaction_date or NULL status are ignored.| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique category identifier |
| category_name | VARCHAR(100) | PhonePe merchant category name |
| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Unique merchant identifier |
| merchant_name | VARCHAR(150) | Merchant display name |
| category_id | INT | Category assigned to the merchant |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| merchant_id | INT | Merchant associated with the transaction |
| transaction_date | DATE | Calendar date of the transaction |
| status | VARCHAR(40) | Transaction processing status |