-- ## 1: すべてのチケット ## -- SELECT p.value AS __color__, t.milestone AS __group__, (CASE status WHEN 'closed' THEN 'color: #aaa; text-decoration: line-through; background: #ddd; border-color: #ccc;' ELSE (CASE owner WHEN $USER THEN 'font-weight: bold;' END) END) AS __style__, id AS ticket, severity AS 重要度, summary AS 概要, component AS コンポーネント, version AS バージョン, status AS ステータス, resolution AS 解決方法, t.type AS 分類, priority AS 優先度, owner AS _担当者, changetime AS 更新日付, time AS _登録日付, reporter AS 報告者 FROM ticket t LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'), (CASE status WHEN 'closed' THEN changetime ELSE (-1) * CAST(p.value AS int) END) DESC