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 d.status = 1' at line 11

select count(distinct d.dealer_id) as total FROM (dealers d, dealers_to_category dtc, dealers_category dc) left join brands_to_dealers btd on d.dealer_id = btd.dealer_id where d.dealer_id = dtc.dealer_id and dtc.cat_id = dc.cat_id and dc.site = 'fahrradinfo' and dc.user_group_id <= '0' and btd.brand_id = and d.status = 1