ERROR :

MYSQL-ERROR : 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 '<= , IF( <= at.dia AND at.dia <= , 1, 0), IF( >= at.dia OR at.d' at line 9
FILE : /var/www/hotelerumv1/modulos/alojamientos/include/class.modelo_alojamiento.php : 1215
SELECT h.id_habitacion, count(h.id_habitacion) AS cantidad,
				MAX(ht.minimo_noches) AS minimo_noches
				FROM hab_habitacion h 
				INNER JOIN hab_disponibilidad hd 
					ON h.id_habitacion = hd.id_habitacion AND hd.habilitado = 1 AND hd.estado > 0
				INNER JOIN mal_alojamientoxtemporada at 
					ON at.id_alojamientoxtemporada = hd.id_alojamientoxtemporada 
					AND IF(
							 <= , 
							IF( <= at.dia AND at.dia <= , 1, 0),
							IF( >= at.dia OR at.dia >= , 1, 0)
						)
				INNER JOIN hab_tarifa ht 
					ON ht.id_alojamientoxtemporada = hd.id_alojamientoxtemporada 
					AND ht.id_habitacion = h.id_habitacion
					AND IF(ht.maximo_noches = 0, true, ht.maximo_noches >= )
					AND if(DAYOFYEAR(CURDATE())<= 1, (1 - DAYOFYEAR(CURDATE())) >= ht.dias_release, 
					(365 - DAYOFYEAR(CURDATE()) + at.dia) >= ht.dias_release )
				WHERE h.id_alojamiento = 146  AND h.habilitado = 1  GROUP BY h.id_habitacion
				HAVING cantidad =