Write a query using window functions to rank Omada Health members by their total weight-loss logging frequency within their first month.
Use the member enrollment date to define the first month. Include members with no qualifying logs, exclude members without an enrollment date, and count only logs recorded from enrollment through the end of the following one-month period.
member_id, member_name, log_count, and frequency_rankfrequency_rank ascending, then member_id ascending| Column | Type | Description |
|---|---|---|
| member_idPK | INT | Unique Omada Health member identifier |
| member_name | VARCHAR(100) | Member display name |
| enrollment_date | DATE | Date the member enrolled with Omada Health |
| Column | Type | Description |
|---|---|---|
| log_idPK | INT | Unique weight logging event identifier |
| member_id | INT | Member associated with the weight log |
| logged_at | TIMESTAMP | Timestamp when the weight was logged |