-- ## 9: Agile Backlog ## -- -- Tickets showing cost and value estimates, and ordered by their ratio. SELECT p.value AS __color__, id AS ticket, summary, component, version, milestone, severity, owner, status, time AS created, changetime AS _changetime, description AS _description, reporter AS _reporter, '' AS value, '' AS cost, 500 - p.value * 100 AS ratio FROM ticket t LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'cost') LEFT OUTER JOIN ticket_custom v ON (t.id = v.ticket AND v.name = 'value') JOIN enum p ON p.name = t.priority AND p.type='priority' WHERE status <> 'closed' ORDER BY ratio DESC, milestone, severity, time