What is Subqueries syntax for Microsoft Query?

与世无争的帅哥 提交于 2019-12-12 04:28:22

问题


I am trying to do a simple subquery join in Microsoft Query, but I cannot figure out the syntax. I also cannot find any documentation for the syntax.

How would I write the following query in Microsoft Query?

SELECT *
FROM (
    SELECT Col1, Col2
    FROM `C:\Book1.xlsx`.`Sheet1$`
) AS a
JOIN (
    SELECT Col1, Col3
    FROM `C:\Book1.xlsx`.`Sheet1$`
) AS b
ON a.Col1 = b.Col1

Is there official documentation for Microsoft Query?


回答1:


SELECT * 
    FROM (SELECT ID, Company FROM (`Sheet1$`)) AS a 
    INNER JOIN 
    (SELECT ID, Name FROM `Sheet1$`) AS b 
    ON a.ID = b.ID;

That worked for me. It looks like the only difference is INNER JOIN vs. JOIN. My fields are ID, Company, Name in that order for Col1, Col2, Col3.




回答2:


Follow Excel the Query Wizard to create/edit queries.

You can access it from Excel menu: Data->Import External Data->Import Data

As well you can check this link http://www.exceluser.com/explore/msquery1_1.htm



来源:https://stackoverflow.com/questions/2804299/what-is-subqueries-syntax-for-microsoft-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!