Marco Kienzle <[EMAIL PROTECTED]> writes: > herring=3D# select sum(agenum) from age where weightmeanage>0 and lengthcel= > l=3D160; > sum=20 > ----- > 77 > (1 row)
> select INTO TABLE temp1 inst, year, month, lengthcell, sex, age, agenum, w= > eightmeanage from age where weightmeanage>0 and lengthcell=3D160 group by i= > nst, year, month, lengthcell, sex,age,agenum, weightmeanage; > herring=3D# select sum(agenum) from temp1; > sum=20 > ----- > 73 > (1 row) Why would you expect these to give the same result? The "group by" effectively eliminates duplicate rows, thus removing some contributions to the sum. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster