<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>uid
total_asset_price</params>
UPDATE
	stock LEFT JOIN movement ON (stock.uid = movement.uid)
SET
	stock.total_asset_price = <dtml-sqlvar total_asset_price type="float">
WHERE
	stock.uid = <dtml-sqlvar uid type="int">
AND
(	movement.quantity > 0  AND stock.quantity > 0
OR	movement.quantity < 0  AND stock.quantity < 0)