Enrico <scotty@xxxxxxxxxxxx> writes: > the first record has valore=98 and totale=0 for the first time of > the loop, but my first result of totale is -298 instead of +98. Hmm, that's a bit hard to believe. Could we see the whole example not just a fragment? Usually, when you can't understand the problem, it's because you're looking in the wrong place --- so a partial example is tough to debug. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match