• Something like this perhaps:

    select

    cpr,

    attendance_date,

    trans_in = max(case when trans_type='I' then 'In' end),

    trans_out = max(case when trans_type='O' then 'Out' end),

    from Table

    group by cpr, attendance_date