select distinct date, s.id_orientation, en, spot from sessions s, orientations o, spots p where p.id_spot=s.id_spot and s.id_orientation=o.id_orientation and p.id_spot=1975 and s.id_orientation=1 and ((ventMin+ventMax)/2 >=10 or (isnull(ventMin) and ventMax>=10) or (ventMin>=10 and isnull(ventMax))) and date_format(date,'%Y')=
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1