zOs/SQL/PDBPKG

set current path oa1p;
select count(*), group_name,
       min(timestamp), max(timestamp)
    from rz1xx.tacct_program
    group by group_name, trunc_timestamp(timestamp, 'ddd')
    order by min(TIMESTAMP) desc, group_name
    with ur
;