Unknown column 'apartaments' in 'where clause': SELECT * FROM propiedades WHERE id = apartaments-habitat ORDER BY alta DESC