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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
mjohnsonuk
Frequent Visitor

ODBC SQL import best practices

Hi All,

 

I was wondering what is the best prctice for ODBC queries

 

I am looking to query two large tables one contains an active status and one doesnt ....

 

If I go to Get data > ODBC > Advanced and type in the SQL below to join the two tables is this the best way or is it best to query both tables seperatly and edit / merge them in power BI before running the close and load ???

than kyou in advance

 

SELECT
a.cust_code,
a.date_created,
a.guarantee_end_date,
a.inv_status_code,
a.invn_code,
a.model,
a.num,
a.prem_code,
a.status_ind,
a.styp_code,
b.cust_code_owner,
b.code,
b.zipc_code,
b.post_in_code,
b.postcode_sector_id
FROM database1.customer a
LEFT OUTER JOIN database1.premise b
ON a.cust_code = b.cust_code_owner
AND a.prem_code = b.code
WHERE a.status_ind ="A"
AND a.styp_code = "ABA"
OR a.styp_code = "ABB"
OR a.styp_code = "ABC";

1 REPLY 1
Anonymous
Not applicable

@mjohnsonuk

From my experience, it is better to write your own custom SQL. You could do the latter but sometimes ODBC does not perform query folding correctly, hence it will perform the join in your local memory instead of at the server. 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.