zOs/SQL/PVS13

select mon, arbid, sum(erstPag#), sum(erstCou#)
    from
        (select
                year(ldatum) * 100 + month(lDatum) as mon,
                left(erstJob,4) arbid,
                erstPag#,
                erstCou#
            from $DBOWNER.vpv013a1a
            where mandant = '0034'
                and left(erstJob,2)
                    in ('W0', 'W1', 'W2', 'W3', 'W4', 'W5')
                and lDatum between '${MONTH}01' and  '${MONTH}31'
        ) t1
    group by      arbid , mon
    order by      arbid desc, mon