-- ## 34: Popular Voted Tickets ## -- -- Tickets ordered by number of votes (> 1) -- -- You must be [/prefs registered] to vote. -- Tickets ordered by number of votes (> 1) -- You must be [/prefs registered] to vote. SELECT p.value AS __color__, t.type AS type, t.id AS ticket, sum(v.vote) as votes, t.summary, t.component, t.version, t.milestone, t.time AS created, t.changetime AS _changetime, t.description AS _description, t.reporter AS _reporter FROM ticket t, enum p, votes v WHERE t.status <> 'closed' AND p.name = t.priority AND p.type = 'priority' AND v.realm = 'ticket' AND v.resource_id = CAST(t.id as text) GROUP BY t.id, t.summary, t.component, t.version, t.milestone, t.type, t.owner, t.time, t.changetime, t.description, t.reporter, p.value, t.status HAVING sum(v.vote) > 1 ORDER BY votes DESC, t.milestone, t.type, t.time