Information générale
Catégorie:
Codage, syntaxe et commandes
Hi all,
I'm experiencing a pretty odd anomoly using a SQL statement. The syntax for this query is as follows :
SELECT table1.field1,table1.field2,table1.field3,sum(table2.field1)as newfield1, ;
table2.field2,(sum(table2.field1)+table2.field2) as newfield2,sum(table3.field1) as newfield3 ;
FROM table1,table2,table3 ;
WHERE table2.field3 == table1.field1 ;
AND table3.field2 == table1.field1 ;
AND table2.field4 == "" ;
AND table3.field3 == "" ;
AND table1.field4 = " ;
GROUP BY table1.field1 ;
ORDER BY table1.field1
My problem is that the sum of newfield3 is always twice as much as what is actually in table3.field1. Can anyone explain why this may be happening ?
TIA
Stacey Wilson
Reinsurance Management Inc.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement