Using SQL query with column as parameter?

Highlighted
New Contributor

Hi. This seems like a simple problem but I'm having trouble finding a solution for pulling data from a SQL database using an existing worksheet column as a parameter. 

 

I have a Column A and Column B. I want to populate Column B using an existing query with Column A as the parameter or "Where" statement. 

 

I have it working to execute on a single cell but can't figure out how to execute the query on all cells in the Column A. 

3 Replies
Highlighted

@anuyen , what do you mean to take column as parameter? Value from each cell will be combined with AND condition under WHERE to query the SQL database?

Highlighted

@Sergei Baklan well the values in column A have a corresponding value in the query, so I'd like to run the query, for example, where column a = a1, a2, a3, a4, a5, a6 etc. 

Highlighted

@anuyen , not sure tat works such way. You may query your SQL database selecting two columns and after left join by PQ your source column with returned from SQL.