Greetings,

How would one go about generating a CASE statement within a query? Example:

              select
                    case
                        when Priority = 0 then 'Low'
                        when Priority = 1 then 'Medium'
                        when Priority = 2 then 'High'
                        when Priority = 3 then 'Urgent'
                    end as GroupType                   
                    ,count(*) as Ticket_Count
                from
                    HPD_HelpDesk
                where
                    dateadd(second, Create_Time, 'Jan 1, 1970') between '#url.startdate#' and '#DateFormat(DateAdd('d', 1, url.enddate), 'YYYY-MM-DD')#'
                    and Resolved_Time is NOT null
                    and Hours_to_Resolve <= 24
                    and Assigned_To_Group_ is not null
                group by
                    Priority
                order by
                    Priority desc

The "Priority" column stores 0,1,2,3 and 4, which in business terms mean 'Low','Medium','High' and 'Urgent' priority respectively. How would I make the equivalent query with SQLObject?

Thanks for your help,

Don