SELECT COUNT(*) FROM (
SELECT p.value AS __color__,
'Estimated difficulty: '||NULLIF(d.value, '') AS __group__,
id AS ticket, summary, milestone,
component, version, t.type AS type,
owner, status, time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
LEFT JOIN ticket_custom d ON (t.id = d.ticket AND d.name = 'difficulty')
WHERE status <> 'closed'
ORDER BY (CASE COALESCE(d.value, '') WHEN 'trivial' THEN 1 WHEN 'easy' THEN 2 WHEN 'medium' THEN 3 WHEN 'hard' THEN 4 WHEN 'insane' THEN 5 ELSE 0 END), CAST(p.value AS int), t.type, time
) AS tab
Note:
See TracReports
for help on using and creating reports.