所以,我有这个:
select ticket_trackingno, ticket_title, ticket_priority_id, ticket_status_id
from hd_tickets
where ticket_priority_id <> 'None'
and ticket_status_id = 'Assigned'
order by ticket_priority_id desc
有了这个,我的ticket_priority_id列被分类为med,low,high。我想要的是低,中,高。我想知道我该怎么做呢?
答案 0 :(得分:12)
ORDER BY CASE ticket_priority_id
WHEN 'low' THEN 1
WHEN 'med' THEN 2
WHEN 'high' THEN 3 END