RE: Updating a field with the result of a select

2002-01-11 Thread Chris Bolt
> Is it possible to update a field with the result of a select. > For example: Try: SELECT @newbalance := ordr_order.total_cost - sum(ordr_payment.amount) FROM ordr_order LEFT JOIN ordr_payment on ordr_payment.ordr_order_id = ordr_order.id WHERE ordr_order.id = 1; UPDATE ordr_order SET balance =

Updating a field with the result of a select

2002-01-11 Thread Webolution
Hi, Is it possible to update a field with the result of a select. For example: UPDATE ordr_order SET balance = ('SELECT ordr_order.total_cost - sum(ordr_payment.amount) FROM ordr_order LEFT JOIN ordr_payment on ordr_payment.ordr_order_id = ordr_order.id WHERE ordr_order.id = 1') WHERE id = 1 W