SELECT * FROM timoveis, tcidades, tcategoria1, tcategoria3 where (ImoCadCodigo = '97481') AND ((Cat3DescricaoSingular like convert('%condominio fechado%' using utf8)) OR (ImoSubCat like convert('%condominio fechado%' using utf8))) and (ImoValor >= 0) and (ImoValor <= 1000000000000000) AND (CidCodigo = ImoCidCodigo) AND (Cat1Codigo = ImoCat1) AND (Cat3Codigo = ImoCat3) and (ImoLiberado = 1) ORDER BY (ImoStatus = 5) DESC, ImoSubCat = 'PR� LAN�AMENTO' ASC, CAST(ImoValor AS SIGNED) DESC LIMIT 0,18