Forum Discussion
Big query temporary table
hi,
how can i use temporary tables (BQ) in sql statement:
begin
CREATE TEMP TABLE tmp_table as
select ID,Country
FROM `prod.Main.Entities` AS entities
where entities.RegistrationDate >='2023-01-01';
End;
begin
select temp.D , Countries.CountryName
from tmp_table as temp
LEFT JOIN `prod.Main.Countries` AS Countries ON temp.Country = Countries.ISO2;
END;
Anonymous , Try with clause
with temp as(
CREATE TEMP TABLE tmp_table as
select ID,Country
FROM `prod.Main.Entities` AS entities
where entities.RegistrationDate >='2023-01-01';
)
select temp.D , Countries.CountryName
from tmp_table as temp
LEFT JOIN `prod.Main.Countries` AS Countries ON temp.Country = Countries.ISO2;
2 Replies
- amitchandakSuper User
Anonymous , Try with clause
with temp as(
CREATE TEMP TABLE tmp_table as
select ID,Country
FROM `prod.Main.Entities` AS entities
where entities.RegistrationDate >='2023-01-01';
)
select temp.D , Countries.CountryName
from tmp_table as temp
LEFT JOIN `prod.Main.Countries` AS Countries ON temp.Country = Countries.ISO2;
- AnonymousNot applicable
thanks!
if i need more then 1 temp table? or if i have performance issue?
is there any other option?