I need to create a query which is linking the data from multiple datasets, new table is created every month. I would like to create a variable which i could use to change table when new tables in datasets apperas, with no need to change each name of the table. I was trying to use "set" and "declare" function but it seems that these variables do not work in dateset names in BQ. Do You know what should i do?
DECLARE reporting_time string; SET reporting_time = "202005";
SELECT layout_instability.cumulative_layout_shift.histogram.bin
FROM
chrome-ux-report.country_pl.reporting_time
where origin like '%sanofi.pl' or origin like '%zentiva.pl' or origin like '%zakrzepica.pl'
union all
SELECT layout_instability.cumulative_layout_shift.histogram.bin
FROM
chrome-ux-report.country_de.reporting_time
where origin like '%sanofi.de'