with loc_1 as (SELECT cast(datestr_start as date) as date_month,
index_nsa as 'SF'
FROM real_estate.freddie_mac_house_price_index
WHERE geo_name = 'San Francisco-Oakland-Berkeley CA'), loc_2 as (SELECT cast(datestr_start as date) as date_month,
index_nsa as 'SEA'
FROM real_estate.freddie_mac_house_price_index
WHERE geo_name = 'Seattle-Tacoma-Bellevue WA'), loc_3 as (SELECT cast(datestr_start as date) as date_month,
index_nsa as 'LA'
FROM real_estate.freddie_mac_house_price_index
WHERE geo_name = 'Los Angeles-Long Beach-Anaheim CA')
SELECT loc_1.date_month,
loc_1.`sf`,
loc_2.`sea`,
loc_3.`la`
FROM loc_1 join loc_2
ON loc_1.date_month = loc_2.date_month join loc_3
ON loc_2.date_month = loc_3.date_month
WHERE loc_1.date_month >= '2020-01-01'
ORDER BY loc_1.date_month desc
Query Title
With on real_estate.freddie_mac_house_price_index and real_estate.freddie_mac_house_price_index and real_estate.freddie_mac_house_price_index