SELECT p.id, p.title, p.department, p.level, p.description, pr.title as reports_to, p.is_active, COUNT(DISTINCT e.id) as employee_count
     FROM positions p
     LEFT JOIN positions pr ON p.reports_to_position_id = pr.id
     LEFT JOIN employees e ON p.id = e.position_id
     GROUP BY p.id, p.title, p.department, p.level, p.description, pr.title, p.is_active