I have this query which does a select on 2 tables listed
The problem is that i really need to update a third table with the results of this first query. I am a little confused as to how to manage the 2 joins needed to do the update. I have
Where have I gone wrong?
Bastien
I wish my computer would do what I want it to do,
instead of what I tell it to do...
Code:
$sql = "select o.orderid, sum(p.weight * o.amount) as weight
from
xcart_order_details o
inner join
xcart_products p
on
o.productid = p.productid
group by o.orderid
order by o.orderid";
The problem is that i really need to update a third table with the results of this first query. I am a little confused as to how to manage the 2 joins needed to do the update. I have
Code:
update xcart_orders o
inner join xcart_order_details d
inner join xcart_products p
on
o.orderid = d.orderid
on
d.productid = p.productid
set total_weight = sum(p.weight * o.amount)
where status = 'C' and order_shipped = 0
Where have I gone wrong?
Bastien
I wish my computer would do what I want it to do,
instead of what I tell it to do...