I want to add the sum of the Value column that is of type Varchar2, I know that to use SUM () I have to use GROUP BY as well, but I can not do the summation. I do not know what fields I have to put in GROUP BY.
SELECT DISTINCT z.sales_office AS kam, z.customer,g.sales_order,
d.nfnum, d.vlr_liq_nf AS valor FROM TPL_GUARDA g
LEFT JOIN TPL_COLETAS c ON g.SALES_ORDER = c.SALES_ORDER
LEFT JOIN humo h ON h.HANDLING_UNIT = g.handling_unit
LEFT JOIN DANFE_DELIVERY dd ON dd.delivery = h.delivery
LEFT JOIN danfe d ON d.nfnum = dd.nfnum
LEFT JOIN zzcustmon z ON z.sales_order = g.sales_order
where c.dt_exp is null and d.nfnum is not null and z.delivery is not null
GROUP BY