<dtml-comment>
title:
connection_id:MySQL
max_rows:10000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params></params>
SELECT
  catalog.relative_url ,
  movement.variation_text ,
  SUM(  stock.quantity ) AS  inventory,
  SUM(  stock.total_asset_price) AS asset_price
FROM
  stock
LEFT JOIN  catalog  ON (  catalog.uid =  stock.resource_uid )
LEFT JOIN  movement  ON (  stock.uid =  movement.uid )
WHERE

GROUP BY
  stock.resource_uid ,  movement.variation_text