0

What is the error in my code

select id , city , address , price , status from Apartments where price > (select avg(price) and status like "not%"from Apartments) order by price;

13th Mar 2021, 7:26 PM
Pranay Sehgal
Pranay Sehgal - avatar
1 Answer
+ 3
Pranay Sehgal There is little mistakes. 1 - there should be price >= 2 - there should not be and status with avg(price) because you are comparing avg with price 3 - there should be status = 'Not rented' select id , city , address , price , status from Apartments where price >= (select avg(price) from Apartments) and status = Not rented order by price; Not rented should be inside single quotes because it's a String.
13th Mar 2021, 8:00 PM
A͢J
A͢J - avatar