28. september 2004 - 17:57Der er
13 kommentarer og 1 løsning
SQL SELECT SUM Problem
Hi All
I have problem with this SQL statement
SELECT ((SUM(S.LLQD) + (SUM(S.KM)) - (SUM(P.LLQD) + (B.AMO)) FROM Send S, Pay P, Bank B WHERE (P.Paid = True);
what i need is like this (20+80) - (50+45) result must be 5 but I get a result which is much bigger what I expectd or much smaller than I expect, I get s/th like 148575,25.
Hi Are you missing some JOIN conditions ? Yes ... No... May be but I am trying to make SQL Query that calculates data from three Tables these 3 tables hav't any relations between them so I don't think it should good idea to make any JOIN.
ex. take two fileds from Send table, take one field from Pay and one from Bank add the first two and substract the other two that i have allready added together.
What usuallly tricks peoples is that ven though there are only one answerer, then just clicking accept do not have any effect. You still need to mark that one answerer and then click accept.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.