Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- ( ( avgWithCriteria - totalAverage ) / ( ( avgWithCriteria + totalAverage ) / 2 ) ) * 100 as percentDifference,
- a.*
- FROM
- (SELECT
- AVG( CASE WHEN 'f' not in ( has_free_parking ) THEN price ELSE null END) as avgWithCriteria,
- AVG( CASE WHEN 'f' in ( has_free_parking ) THEN price ELSE null END) as avgWithoutCriteria,
- AVG( price ) as totalAverage,
- neighbourhood_cleansed
- FROM listings
- WHERE city_name="berlin"
- AND price <= 1000000
- AND price >= -1
- AND reviews_per_month <= 1000000
- AND reviews_per_month >= -1
- AND est_monthly_income <= 1000000
- AND est_monthly_income >= -1
- GROUP BY neighbourhood_cleansed ) a;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement