+ Reply to Thread
Results 1 to 11 of 11

MS QUERY SQL syntax

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    MS QUERY SQL syntax

    Hi Guys,

    I am trying to create inner join between 2 tables within different workbooks like below:

    MS QUery.png

    I do not know what exactly syntax should look like, i was trying with :

    Please Login or Register  to view this content.
    How can i do it?

    (it is MS Query, not a power query).
    Best Wishes,
    Jacek

  2. #2
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Anyone?

    Jacek

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Hi Guys,

    it is possible?

    Jacek

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: MS QUERY SQL syntax

    Here's a tutorial on MS Query Joins.

    https://support.microsoft.com/en-us/...icrosoft-query
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    07-26-2013
    Location
    BL, Bosnia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: MS QUERY SQL syntax

    Hi,

    Generally, you are missing a join condition. In order to join two tables you have to specify how these two tables are joined:
    1. Which type of join it is (inner, left, right, full...)
    2. Which fields are used for joining (table1.ID vs table2.ID for example)..

    This would mean that your come more or less looks ok, however, you are missing "ON" clause after INNER JOIN... This is explained in the article linked by Alan.

  6. #6
    Registered User
    Join Date
    11-21-2017
    Location
    Warsaw
    MS-Off Ver
    2010 PRO
    Posts
    1

    Re: MS QUERY SQL syntax

    Hello! Same problem here, I'm kind of dummy though

    Ussually I join tables in that scheme:


    SELECT `Arkusz1$`.kol1, `Sheet1$`.kol2, `Sheet1$`.kol3
    FROM `C:\Users\USER\FILE_ONE.xlsx`.`Sheet1$` `Sheet1$`

    UNION ALL

    SELECT `Arkusz1$`.kol1, `Sheet1$`.kol2, `Sheet1$`.kol3
    FROM `C:\Users\USER\FILE_TWO.xlsx`.`Sheet1$` `Sheet1$`


    (and so on depending on quantity of tables)



    How to do it using join?
    Could anyone give some example?

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Hi Guys,

    i tried solutions from your link above and i do not still why my syntax is incorrect.

    Please share a sample.

    I appreciate any help,
    Best Wishes
    Jacek

  8. #8
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Hi Guys,

    please help,

    Jacek

  9. #9
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Hi Guys,

    still the problem with this.

    I am thinking if it is possible at all.

    I am trying to implement code:
    Please Login or Register  to view this content.
    but i have to do inner join in correct way:
    Select * from Table1 inner join Table2 on Table1.Col1 = Table2.Col2

    I has to give the name to a table in order to create inner join perhaps?

    In attachment please see my sample files and queries.
    Please Help,
    Jacek Antek
    Attached Files Attached Files

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: MS QUERY SQL syntax

    You can do that with PowerQuery (add-in for Ex2010)

  11. #11
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: MS QUERY SQL syntax

    Yes,

    but i am boss and i know what is an answer here ;-)

    For all inner join for example in attachment:

    Please Login or Register  to view this content.
    Jacek

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. An 'IF NOT ISEMPTY' syntax query
    By Kayote in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-02-2009, 06:32 PM
  2. Static Web Query Syntax
    By Pak Bob in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2008, 02:26 PM
  3. Syntax Query
    By Chuckles123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2007, 05:07 PM
  4. syntax query
    By mpeplow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-19-2007, 11:53 AM
  5. SQL query syntax
    By Wim in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-20-2006, 04:55 PM
  6. [SOLVED] Microsoft Query syntax
    By Krish in forum Excel General
    Replies: 0
    Last Post: 10-07-2005, 10:05 AM
  7. MS Query - Alias syntax
    By David P in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-16-2005, 06:06 AM
  8. Syntax for ADO Query String
    By John in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2005, 05:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1