Query not displaying data in Excel

Clan57

New Member
Joined
May 7, 2015
Messages
28
Hi,

I'm trying to query a few tables in our SQL server directly from excel so that the data is imported whenever I hit refresh.

I used "Get External Data From Microsoft Query" so that I could query the server without returning the entire results (probably a few hundred thousand records when my query would probably return about 1000).

However,

When I insert the query in Microsoft query, it displays the results of the query with no problem, then, when I choose to return the data to a cell in Excel, the query executes but the ONLY thing displayed in the worksheet is "Query from [SQL Server Name]".

My query contains a LEFT JOIN which my googling has so far indicated may be part of the problem, but no solution yet..
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Query looks something like this - I've added the { oj } and changed LEFT JOIN to LEFT OUTER JOIN based on other posts I've found - but no luck yet.

Code:
USE Database_Name;

SELECT A.Id
, A.Name
, B.State
, B.Country


FROM {oj TableA A
LEFT OUTER JOIN TableB B ON  A.Id = B.Id}


WHERE 
A.Name LIKE '%test%'
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,937
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top