Your question is Weekly Integration Error Clients. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a PostgreSQL query to find all clients that had more than three Alabama Staffing integration errors in the past 7 days. Return the client ID, client name, account manager, and total error count. Count only rows where status = 'error', aggregate across all integrations owned by the same client, and sort by error_count descending then client_name ascending.
| Column | Type | Description |
|---|---|---|
| client_id | ||
| client_name | ||
| account_manager | ||
| is_active |
| Column | Type | Description |
|---|---|---|
| integration_id | ||
| client_id | ||
| integration_name | ||
| platform |
| Column | Type | Description |
|---|---|---|
| event_id | ||
| integration_id | ||
| event_time | ||
| status | ||
| error_code |
| 1 | Northstar Health | Maya Patel | true |
| 5 | Cedar Logistics | Maya Patel | false |
| 101 | 1 | ATS Sync | Greenhouse |
| 107 | 5 | Timekeeping Sync | UKG |
| 1001 | 101 | 2024-06-14 09:15:00 | error | AUTH_FAILED |
| 1015 | 107 | 2024-06-14 18:20:00 | error | AUTH_FAILED |