SELECT
CASE WHEN t.status='new' THEN '#ffaa99'
WHEN t.status='active' THEN '#f2dcdc'
WHEN t.status='review' THEN '#e8e8bd'
WHEN t.status='tested' THEN '#bde5d6'
ELSE '#cacae5' END as 'bgcolor',
t.tn AS '#',
e.value AS '类型',
t.status AS '状态',
sdate(t.origtime) AS '创建时间',
t.owner AS '创建人',
t.subsystem AS '子系统',
sdate(t.changetime) AS '更新时间',
t.assignedto AS '分配给',
t.severity AS '严重',
t.priority AS '优先',
t.title AS '标题'
FROM enums e, ticket t
WHERE e.type='type'
AND e.name=t.type
AND t.status NOT IN ('fixed','closed')
AND t.assignedto=user()
ORDER BY t.priority, t.severity, t.origtime