How to use custom SQL select statement in excel

Occasional Visitor


Hi everyone, I have an Excel workbook in which i have 3 queries that I have imported using the "Get data from Table/Table" function. I need to use a select statement to retrieve certain information from the 3 different tables in the workbook using joins in the select statement. Please see below SQL,


"SELECT top 10000 [T.PrImaryIP], [PT.KB] , [PT.CVE], [PT.Date], [T.ComputerName], [S.Status]

from [Template$] AS [T], [Servers List$] AS [S]

left outer join [Patch Data$] as [PT] on PT.KB = T.KBID and

left outer join [Servers List$] AS [S] on S.IPAddress = T.PrimaryIP"


My problem is that I do not know where to place the query, I tried using the Advenced Editor but it does not bring back the results. Can anyone please help

1 Reply

You may embed SQL query only within connection to SQL database. If you query the tables from the Excel sheet use Merge Queries, Filter, etc in Power Query Editor menu (and/or M-Script code if you are familiar with it).