There is an error on the SQL command.

SQL:
SELECT *, IF(CODIGOW<>'',CODIGOW,CODIGO) AS CODIGOW, DORMITORIO as DORM, VAGAS as VAGA, AREA_PRIVATIVA as AREAP, AREA_TOTAL as AREAT, AREA_CONSTRUIDA as AREAC FROM fbz_imoveis imo WHERE VER_WEB='Sim' AND (STATUS = 'VENDA' OR STATUS = 'ALUGUEL' OR STATUS = 'VENDA E ALUGUEL') AND imo.CODIGO<>17523 AND imo.CODIGO_CIDADE='barra-do-pirai' AND (imo.CODIGO_CATEGORIA='terreno') AND (imo.STATUS='Venda') ORDER BY imo.CODIGO_BAIRRO='bairro-de-fatima' desc, imo.DORMITORIO>='0' desc, imo.VAGAS>='0' desc, imo.SUITE>='0' desc, imo.CODIGO_EMPREENDIMENTO='reserva-residencial' desc, RAND() LIMIT 5

Error:
Lost connection to MySQL server during query