Sheldon Livingston
asked on
SQL Query returning inflated numbers
My query:
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.
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))
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.