i created this but it does not get the correct data
SELECT
s.firstname AS staff_member,
SUM(CASE WHEN t.status_id IN (1, 2) THEN 1 ELSE 0 END) AS open_tickets,
SUM(CASE WHEN t.status_id = 3 THEN 1 ELSE 0 END) AS closed_tickets,
COUNT(t.ticket_id) AS thread_count,
SUM(CASE WHEN t.staff_id IS NOT NULL THEN 1 ELSE 0 END) AS assigned_tickets
FROM
ost_ticket t
left JOIN
ost_thread th ON t.ticket_id = th.object_id
JOIN
ost_staff s ON t.staff_id = s.staff_id
WHERE
t.created >= DATE_SUB(NOW(), INTERVAL 30 DAY) && th.object_type='T'
GROUP BY
s.username
ORDER BY
s.username;
KevinTheJedi