SELECT COUNT(distinct a.ElementID) as anzahl FROM ai_objektindex AS a INNER JOIN ((select distinct elementid from ad_attribut WHERE Name='Eigener Pool') AS t0(select distinct elementid from ad_attribut WHERE Name='Aufzug') AS t1) ON a.ElementID=t0.ElementID AND a.ElementID=t1.ElementID and sichtbarkeit = 1 and (freieTermine=1)
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 '(select distinct elementid from ad_attribut WHERE Name='Aufzug') AS t1) ON a.Ele' at line 1