select sum(hours) hours, (case when ji.resolution not in (-1,1) then 'No Action' when wl.verify = 1 then 'Verify' else 'Maintenance' end) timetype from jiraissue ji, worklog wl where ji.type = 11 and ji.id = wl.issue and wl.startdate >= '04/02/11' and wl.startdate <= '07/01/2011' and wl.author in (select resource from resource) group by (case when ji.resolution not in (-1,1) then 'No Action' when wl.verify = 1 then 'Verify' else 'Maintenance' end)