Invalid query: Disk full (/var/tmp/#sql_a3b_2); waiting for someone to free some space...
SELECT DISTINCT b.id, b.name, b.path, b.width, b.height, b.url, b.priority, b.body_text
FROM banner b
JOIN banner_has_category hc ON b.id=hc.banner_id
AND ( -- banner in self and child categories
(hc.with_childs=1 AND hc.category_id IN (0, 1281, 1284, 1376, 1377, 1438))
OR -- banner in only my category
(hc.with_childs=0 AND hc.category_id=1438)
)
WHERE b.status > 0
AND b.type=0
ORDER BY b.priority DESC