This is my code:
SELECT * FROM Apartments
WHERE price > AVG(price) AND Status = "not rented" AND
ORDER BY price;
but I get a syntax error
ERROR: syntax error at or near "ORDER"
LINE 3: ORDER BY price;
^
CodePudding user response:
select * FROM Apartments
WHERE price > (SELECT AVG(price) FROM APARTMENTS)
and Status = 'not rented'
ORDER BY price;
CodePudding user response:
SELECT * FROM Apartments
WHERE Price > (SELECT AVG(Price) FROM Apartments)
AND status="not rented"
ORDER BY price;