oracle8.1.6
select wta.party_id,
acs_object.name(wta.party_id) as party_name,
count(ticket_id) as total,
sum(decode(lower(wc.state),'active',1,0)) as active,
sum(decode(lower(wc.state),'suspended',1,0)) as suspended,
sum(decode(lower(wc.state),'canceled',1,0)) as canceled,
sum(decode(lower(wc.state),'finished',1,0)) as finished,
max(tt.creation_date) as latest,
min(tt.creation_date) as oldest
from ttracker_tickets tt,
ttracker_categories tc,
wf_cases wc,
wf_task_assignments wta
where tc.package_id = :package_id and
tt.category_id = tc.category_id and
tt.ticket_id = wc.object_id and
wta.task_id = (select max(wt.task_id)
from wf_tasks wt
where wt.case_id = wc.case_id and
wt.transition_key = 'resolve')
[ad_dimensional_sql $dimensional]
group by wta.party_id
[ad_order_by_from_sort_spec $orderby $table_def]
tt.creation_date + 365 > sysdate
tt.creation_date + 90 > sysdate
tt.creation_date + 30 > sysdate