Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
liorro
Helper I
Helper I

Big query temporary table

hi,

 

how can i use temporary tables (BQ) in sql statement:

 

liorro_0-1673877854159.png

 

 

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;

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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;

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@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;

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks!

if i need more then 1 temp table? or if i have performance issue?

is there any other option? 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors