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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mjjuk
Helper I
Helper I

Limiting an SQL Query from values in a salesforce Table

Hi All, 

 

I am trying to load a table from an ODBC database but only bring in the values from a salesforce table I have loaded in .....

I have a column in the Salesforce table called "job Number"     (roughly 100k job numbers) I have been told that is too much for a keylist.

 

The ODBC table has millions of job numbers

I want to be able to run the ODBC SQL query to only bring back the job numbers in the Salesforce table  

 

 

The keylist way meant I used applied steps and brought in the Saleforce table then removed all other columns, then created a new column "'"&[Job Numbers]&"'" then combined to create the keylist... then in the SQL I wrote

Select 

job number,

visit report,

visit number,

status

from database.table2

where job number IN ("'"&[keylist]&"'")

 

it works fine for a small number but affects performance with larger data sets ..... I am hoping I have explained this well, I really could do with a more efficiant way 

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @mjjuk ,

 

We can enter sql statement to filter the data in advance for the ODBC connector.

 

odbc.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi v-frfei_msft,

 

I usually write in the SQL in this advanced section but how would i reference the Salesforce table?

 

Are you thinking a EXISTS SQL?

SELECT column_name(s)
FROM table_name
WHERE EXISTS
(SELECT column_name FROM table_name WHERE condition);

 

Is it possible to reference a Salesforce Object in this way?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors