Page 1 of 1

need help with joins

Posted: Sat Apr 17, 2004 6:44 pm
by nikko50
I'm trying to join 2 tables for a query. The query will summarize all items shipped and all items received regardless of quantity. I have 2 tables one called shipped and one called receive. Each table contains an equipment field and a quantity field. The code below does not work well because it does not return the correct quantities shipped or received for each individual equipment. In both tables there is duplicate records for equipment shipped or equipment received. I need help on this cause I have no idea how to summarize the two tables.


$equiplist= "select receive.equipment, sum(receive.quantity) as 'receivedsum', sum(shiplist.quantity) as 'shippedsum'
from receive
left join shiplist on shiplist.equipment = receive.equipment
group by receive.equipment";

Posted: Sun Apr 18, 2004 2:06 am
by JAM
For others reading this, it's (also) being discussed in viewtopic.php?t=21030