Link to home
Start Free TrialLog in
Avatar of Sheldon Livingston
Sheldon LivingstonFlag for United States of America

asked on

SQL Query returning inflated numbers

My query:
SELECT     somast.fsono, somast.fstatus, SUM(soitem.fquantity) AS itemsOrdered, SUM(shitem.fshipqty) AS itemsShipped
FROM         somast LEFT OUTER JOIN
                      soitem ON somast.fsono = soitem.fsono LEFT OUTER JOIN
                      shmast ON somast.fsono = shmast.fcsono LEFT OUTER JOIN
                      shitem ON shmast.fshipno = shitem.fshipno
GROUP BY somast.fsono, somast.fstatus
HAVING      (SUM(soitem.fquantity) <> SUM(shitem.fshipqty))

Open in new window


is resulting in the itemsOrdered being multiplied by the number of items and the itemsShipped being multiplied by something as well.

I'm not sure what more info you guru's need/want.
ASKER CERTIFIED SOLUTION
Avatar of UnifiedIS
UnifiedIS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial