zOs/SQL/QZ063
with g as
(
select count(*) c, timestamp, ssid, event_type, plan_name, conn_id,
corrid_id, authid, logRec, rz, dbSys
from oa1p.tqz063uow
where timestamp >= '2014-04-01-00.00.00'
group by timestamp, ssid, event_type, plan_name, conn_id,
corrid_id, authid, logRec, rz, dbSys
)
select trunc_timestamp(timestamp, 'dd'), count(*) cnt
, sum(case when c > 1 then 1 else 0 end) mult
, sum(case when c > 1 then c else 0 end) multSum
from g
group by trunc_timestamp(timestamp, 'dd')
order by 1 desc
with ur