postgresql7.1
select apm_package__name(:package_id)
select tt.ticket_id,
tt.subject,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.creation_date as created,
ca.case_id,
tc.name as category,
ta.task_id,
ta.transition_key as to_do
from ttracker_tickets tt,
wf_cases ca,
ttracker_categories tc,
wf_task_assignments w,
wf_tasks ta, party_approved_member_map map
where ca.object_id = tt.ticket_id and
ca.state = 'active' and
tt.category_id = tc.category_id and
tc.package_id = :package_id and
w.party_id = map.party_id and
map.member_id = :user_id and
ta.case_id = ca.case_id and
ta.task_id = w.task_id and
(ta.state='enabled' or
(ta.state='started' and ta.holding_user=:user_id))
[ad_order_by_from_sort_spec $orderby $table_def]
select tt.ticket_id,
ttracker_option__option_name(:package_id, 'severity', tt.severity)
as pretty_severity,
ttracker_option__option_name(:package_id, 'priority', tt.priority)
as pretty_priority,
tt.subject,
to_char(tt.creation_date, 'MM/DD/YYYY HH24:MI') as created,
tc.name as category,
ta.task_id
from ttracker_tickets tt,
ttracker_categories tc,
wf_cases ca,
wf_tasks ta
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
ca.object_id = tt.ticket_id and
ca.state = 'active' and
ta.case_id = ca.case_id and
not exists (select tasn.task_id
from wf_task_assignments tasn
where tasn.task_id = ta.task_id)
[ad_order_by_from_sort_spec $orderby $table_def]