Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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;
Solved! Go to Solution.
@liorro , 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;
@liorro , 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;
thanks!
if i need more then 1 temp table? or if i have performance issue?
is there any other option?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 104 | |
| 81 | |
| 69 | |
| 50 | |
| 46 |