<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params></params>
SELECT DISTINCT
	count(distinct item.uid)
FROM
	catalog AS item

LEFT JOIN category
ON (category.category_uid=item.uid
AND category.base_category_uid = <dtml-var "portal_categories.aggregate.getUid()">)

LEFT JOIN stock
ON (stock.uid = category.uid
AND stock.node_uid = <dtml-var "portal_categories.site.Stock_MP.Gravelines.getUid()">
AND  stock.quantity < 0)


WHERE item.portal_type = "Piece Tissu"
AND category.uid IS NULL
AND item.id = "41347"