postgresql7.1
select tt.ticket_id,
ttracker_option__option_name(tc.package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(tc.package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
tc.name as category,
cr.content as description,
cr.mime_type
from ttracker_tickets tt, ttracker_categories tc, cr_revisions cr
where tt.ticket_id = :ticket_id and
tt.category_id = tc.category_id and
cr.revision_id = content_item__get_live_revision(:ticket_id)