Subject union all and group by
Author Maurizio
hi , i am try to make a select from 2 tables something like this :

SELECT F.frdescr1 AS "Fornitore " , SUM(DM.mrqtamov ) AS "Qtà Acquisto"
, 0 as "Qtà Resa "
FROM tmovmagamaster M
JOIN tmovmagadetail DM ON (M.mmidriga = DM.mr____fk )
JOIN tcaumag CM ON (CM.cmcodcau = M.mmcaumag )
JOIN tfornitori F ON (F.frcodfor = M.mmcodfor )
WHERE CM.cmcommov = 'P'
GROUP BY F.frdescr1

UNION ALL

SELECT F2.frdescr1 AS "Fornitore " , 0 AS "Qtà Acquisto" ,
SUM(DD.dtqtamov ) as "Qtà Resa "
FROM TDOCMASTER MV
JOIN tdocdetail DD ON (MV.dm__key1 = DD.dt_kmast )
join tcaudocumenti CD on (CD.cdcodice = MV.dmcodcau )
JOIN tfornitori F2 ON (F2.frcodfor = MV.dmcodfor )
WHERE CD.cdcodice = 'REF'
GROUP BY F2.frdescr1

it does not function .
what i want to do is to have the select grouped by the first column ,
globally .

i just hope i have been clear .

thanks

Maurizio