select JAHR, MONAT, TAG, PSP, PSPDETAIL, USKURZZ, STUNDEN, KOSTEN

   from CCILVD  

  where PSP like CONCAT((select PSPcode from CCTASK where TASKTYPE='JAP' and PROJECT=?),'%') 

               and JAHR=?

UNION

select JAHR, MONAT,'Summe' as TAG, 'Summe' as PSP, 'Summe' as PSPDETAIL, USKURZZ,

           SUM(STUNDEN) as STUNDEN, SUM(KOSTEN) as KOSTEN

  from  CCILVD 

  where  PSP like CONCAT((select PSPcode from CCTASK where TASKTYPE='JAP' and PROJECT=?),'%') 

                and JAHR=?

 group by JAHR,MONAT,USKURZZ

UNION

select JAHR, MONAT,'Summe' as TAG, 'Summe' as PSP, 'Summe' as PSPDETAIL, 'Summe' as USKURZZ,

           SUM(STUNDEN) as STUNDEN, SUM(KOSTEN) as KOSTEN

  from  CCILVD 

  where  PSP like CONCAT((select PSPcode from CCTASK where TASKTYPE='JAP' and PROJECT=?),'%') 

                and JAHR=?

 group by JAHR,MONAT

UNION

select JAHR, CONCAT('Summe-Monate: ',GROUP_CONCAT(distinct MONAT)) as MONAT,'Summe' as TAG, 'Summe' as PSP, 'Summe' as PSPDETAIL, 'Summe' as USKURZZ,

           SUM(STUNDEN) as STUNDEN, SUM(KOSTEN) as KOSTEN

  from  CCILVD 

  where  PSP like CONCAT((select PSPcode from CCTASK where TASKTYPE='JAP' and PROJECT=?),'%') 

                and JAHR=?

 group by JAHR