Keine Portokosten
Innerhalb von Deutschland
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND tempt.gesamtmenge > 0 AND ptg.status = 1 GROUP BY' at line 22

SELECT ptg.products_tags_group_id, mitptg.media_image_id FROM products p LEFT JOIN products_tags_group_to_products ptgtp ON p.products_id = ptgtp.products_id LEFT JOIN products_tags_group ptg ON ptgtp.products_tags_group_id = ptg.products_tags_group_id LEFT JOIN (SELECT products_tags_group_id, SUM(products_lager_menge) as gesamtmenge FROM `products_lager` GROUP BY products_tags_group_id HAVING gesamtmenge > 0) as tempt ON tempt.products_tags_group_id = ptg.products_tags_group_id LEFT JOIN klu_media_image_to_products_tags_group mitptg ON tempt.products_tags_group_id = mitptg.products_tags_group_id WHERE p.products_id = AND tempt.gesamtmenge > 0 AND ptg.status = 1 GROUP BY mitptg.media_image_id