WITH combined_data AS (
SELECT place_name, date, variable, value
FROM @datacommons.countries.united_states_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.japan_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.germany_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.russia_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.united_kingdom_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.china_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.india_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.france_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.canada_timeseries_stats
UNION ALL
SELECT place_name, date, variable, value
FROM @datacommons.countries.italy_timeseries_stats
)
SELECT
place_name,
value as max_temp_2040
FROM combined_data
WHERE combined_data.variable = 'MaxTemp_Daily_Hist_95PctProb_Greater_Atleast1DayADecade_CMIP6_Ensemble_SSP585'
and date = 2040
order by value desc