-- ## 8: Active Tickets, Mine first ## -- -- -- * List all active tickets by priority. -- * Show all tickets owned by the logged in user in a group first. SELECT ( CASE owner WHEN $USER THEN 'My Tickets' ELSE 'Active Tickets' END ) AS __group__, ( -- This is the priority number, taken from the lookup table. SELECT value FROM enum WHERE enum.type = 'priority' AND enum.name = ticket.priority ) AS __color__, priority, milestone, type, id AS ticket, summary, component, version, owner, status, time AS created, changetime AS _changetime, description AS _description, reporter AS _reporter FROM ticket WHERE status <> 'closed' ORDER BY __group__ DESC, __color__, milestone, type, id