Conveyor:
Serial 100000 100001
Support Serial Cost 10000 100 10000 150 10001 200 10001 250
Accessory Serial Cost 10000 50 10000 75 10001 100 10001 200
Desired Result Serial SupportCost AccessoryCost 100000 250 125 100001 450 300
Roger:
Try the following:
create temporary table support_cost (primary key serial) select serial,sum(cost) from conveyor,support where conveyor.serial = support.serial group by serial;
create temporary table accessory_cost (primary key serial) select serial,sum(cost) from conveyor,accessory where conveyor.serial = accessory.serial group by serial;
select s.serial,s.cost as support_cost,a.cost as accessory_cost from support_cost s, accessory_cost a where s.serial = a.serial;
-- Sasha Pachev Create online surveys at http://www.surveyz.com/
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]