SELECT COUNT(*) FROM (
SELECT (CASE status WHEN 'closed' THEN 6
ELSE
(CASE priority
WHEN 'highest' THEN 1
WHEN 'high' THEN 2
WHEN 'normal' THEN 3
WHEN 'low' THEN 4
WHEN 'lowest' THEN 5
ELSE ''
END)
END) AS _color,
component AS _group,
id AS ticket,
version, status, t.type AS type, severity, priority,
owner, summary
FROM ticket
ORDER BY component,
(CASE status WHEN 'closed' THEN 1 ELSE 0 END),
(CASE priority
WHEN 'highest' THEN 1
WHEN 'high' THEN 2
WHEN 'normal' THEN 3
WHEN 'low' THEN 4
WHEN 'lowest' THEN 5
END),
severity, time
) AS tab
Note:
See TracReports
for help on using and creating reports.