Hi, I report the query in short format and I hope being enough: "SELECT DISTINCT r.*, r.total FROM (SELECT d.*, SUM(ABS(d.IMP_MOV_EURO)) AS total FROM (SELECT f.*, f.IMP_MOV_EURO FROM (subquery expression) f ) d ) r " At the top, in the final select distinct, I must report the column "total" that has been calculated in the previous query with the expression "SUM(ABS(d.IMP_MOV_EURO)) AS total". SUM(ABS(d.IMP_MOV_EURO)) AS total doesn't work; I also tried with "SUM(CAST(ABS(d.IMP_MOV_EURO)) AS total)" without fortune.
... View more