<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, catalog.path, catalog.id, resource.relative_url as resource, variation.relative_url as variation
FROM catalog

LEFT JOIN category ON (category.uid = catalog.uid
AND category.base_category_uid = <dtml-var "portal_categories.resource.uid">)
LEFT JOIN category as cat2 ON (cat2.uid = catalog.uid
AND cat2.base_category_uid = <dtml-var "portal_categories.coloris.uid">)
LEFT JOIN catalog as resource ON (resource.uid = category.category_uid)
LEFT JOIN catalog as variation ON (variation.uid = cat2.category_uid)
WHERE catalog.portal_type = "Piece Tissu"
AND catalog.location <> ''
AND catalog.location <> 'None'

AND not (category.uid is NULL OR cat2.uid is NULL)