0

I want to update a colume using results from an select query but its not working :( my code:

UPDATE goods
SET goods.wagons_needed = (SELECT (goods.QUANTITY * WEIGHT) / max_payload as wneed
FROM GOODS INNER JOIN wagon_type 
ON goods.wagon_type_id = wagon_type.wagon_type_id
order by goods.goods_id)
where goods.goods_id = goods.goods_id;

Thanks for any help.

3
Contributors
2
Replies
12
Views
4 Years
Discussion Span
Last Post by IIM
0

give your table structure? It seems your select query is returning multiple record.Try running the select query sepately in your mysql client and check its output.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.