SELECT offerte.id, offerte.dal, offerte.al, offerte., offerte., offerte., offerte.offerta_consigliata, offerte.offerta_piu_bassa, offerte.prezzo, offerte.prezzo_offerta, offerte.loghetto, offerte.min_stay, strutture.albid AS id_struttura, strutture.nome, strutture.categoria, strutture.comune, strutture.website, strutture.foto FROM offerte_alloggi offerte INNER JOIN alberghi strutture ON (offerte.cod_cliente = strutture.albid AND 1 AND ( (DATEDIFF(DATE_SUB(al, INTERVAL IF(min_stay>0,min_stay,1) DAY) , DATE_ADD(NOW(), INTERVAL 0 DAY)) >= 0)) AND (strutture.albid = 1000)) WHERE (offerte. != '' AND offerte. != '' AND offerte. != '') ORDER BY strutture.priorita DESC, offerte.posizione ASC 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 ' offerte., offerte., offerte.offerta_consigliata, offerte.offerta_piu_bassa, off' at line 1