Write a SQL query to identify payroll runs with the highest error rates by customer, state, and pay period at Miter. Consider completed runs with more than zero employees processed. Calculate error rate as errors divided by employees processed, treat a missing error count as zero, and include ties.
Output
- One row per highest-error payroll run, with
customer_name, state, pay_period_start, run_id, error_rate, and rate_rank.
- Include only tied highest-rate runs within each customer, state, and pay period, ordered by customer, state, pay period, and run ID.