c'è sum anche nella seconda select, mettici la group by --