Hello there,i got stuck here with this query. I joined 2 tables and do the sum for total amount, but the query results in duplicated rows and the total amount also incorrect. I wrote a query for each of the tables and it worked fine, but the problem appears after i joined the tables. Can anyone find out what's wrong with my query? Thanks in advanced.here's the sample of the tables: CustomerOrdersOrdID Item OrdDate ProdID Amount ShipmentDateS010 1 2000/1/17 21ZXD0 1000 2000/1/26S010 2 2000/1/17 31ZXD3 1000 2000/1/27S010 3 2000/1/17 91ZXD4 1000 2000/2/12 S010 4 2000/1/17 51ZX3S 1000 2000/2/14OrdersOutOutID Item ProdID Amount ShipmentDate OrdIDAB123 1 21ZXD0 500 2000/1/25 S010AB124 1 21ZXD0 500 2000/1/25 S010AB125 2 31ZXD3 500 2000/1/27 S010AB126 2 31ZXD3 500 2000/2/2 S010AB127 3 91ZXD4 1000 2000/2/12 S010AB128 4 51ZX3S 1000 2000/2/14 S010SELECT customerOrders.OrdID, customerOrders.OrdDate, SUM(customerOrders.Amount) AS TotalOrder, SUM(OrdersOut.Amount) AS TotalOut, SUM(customerOrders.Amount) - SUM(OrdersOut.Amount) AS DiffFROM customerOrders LEFT OUTER JOIN OrdersOut ON customerOrders.OrdID = OrdersOut.OrdIDWHERE (customerOrders.Customer = 'Joe') AND (customerOrders.OrdID IN (SELECT OrdID FROM CustomerOrders WHERE ordDate < '2000/1/31')) AND (OrdersOut.OrdID IN (SELECT OrdID FROM OrdersOut WHERE ShipmentDate < '2000/1/31')) AND (customerOrders.OrdID IN (SELECT OrdID FROM CustomerOrders WHERE OrdDate BETWEEN '2000/1/1' AND '2000/1/31'))GROUP BY customerOrders.OrdID, OrdersOut.Amount, customerOrders.OrdDatethe result i expect is:OrdID OrdDate TotalOrder TotalOut DiffS010 2000/1/17 2000 1500 500but my result is:OrdID OrdDate TotalOrder TotalOut DiffS010 2000/1/17 12000 6000 6000S010 2000/1/17 6000 6000 0