oracle8.1.6 select tt.creation_user as user_id, acs_object__name(tt.creation_user) as user_name, count(ticket_id) as total, sum(case when lower(wfc.state)='active' then 1 else 0 end) as active, sum(case when lower(wfc.state)='suspended' then 1 else 0 end) as suspended, sum(case when lower(wfc.state)='canceled' then 1 else 0 end) as canceled, sum(case when lower(wfc.state)='finished' then 1 else 0 end) as finished, max(tt.creation_date) as latest, min(tt.creation_date) as earliest from ttracker_tickets tt, ttracker_categories tc, wf_cases wfc where tc.package_id = :package_id and tt.category_id = tc.category_id and tt.ticket_id = wfc.object_id [ad_dimensional_sql $dimensional] group by tt.creation_user [ad_order_by_from_sort_spec $orderby $table_def] tt.creation_date + '365 days'::interval > now() tt.creation_date + '90 days'::interval > now() tt.creation_date + '30 days'::interval > now()