Using group by on several tables with problems
I solved it that way:

  select
        SR.AN_RAP as AN, RAP.CF,
        max(col_cant.CANT_VAL) as CANT_VAL,
        max(col_cant.COD_VALORIFICARE) as COD_VALORIFICARE
    from dma
        inner join ch on ch.id=DMA.CH_ID
    inner join
            (select CANT.ID,CANT.FK_ID_MUN,CANT.CANT_VAL,CANT.COD_VALORIFICARE from cant
            union
            select  COL.FK_ID_COL_DMA,CANT2.FK_ID_MUN,COL.CANT_VAL, COL.COD_VALORIFICARE from col 
                inner join cant2 on cant2.id=COL.FK_ID_COL_DMA
            ) col_cant 
       on col_cant.FK_ID_MUN=ch.id
    inner join sr on SR.ID=CH.FK_ID_SR
    inner join rap on RAP.ID=CH.FK_ID_RAP
    where RAP.CF='123-123'
    group by SR.AN_RAP,RAP.CF,CANT.ID,DMA.FK_AMB_ST,
            col_cant.COD_VALORIFICARE
    order by sr.an_rap desc,rap.cf,col_cant.id