The script below can be used to find how many Service Tickets are set to each status
select distinct d.Ticket_Status,
count(d.ticket_status) as "Count of Tickets by Status"
from AR_customer a, AR_customer_site b, ar_customer_system c, sv_service_ticket d
Where d.Customer_Id = a.Customer_Id
and d.Customer_Site_Id = b.Customer_Site_Id
and d.Customer_System_Id = c.Customer_System_Id
and d.ClosedDate = '1899-12-30 00:00:00:000'
and d.Ticket_Status <> 'CL'
Group by d.Ticket_Status
Order by d.Ticket_Status