Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Importing more than one table in a single query?

Hi everyone! I use Blank Query and this formula to retrieve my data;         let Source = (sql_instance as any) => let Result = Sql.Database(sql_instance, "ProductionDB", [Que...
  • ImkeF's avatar
    3 years ago

    Hi Anonymous ,
    not sure how the tables relate to each other, but you could either append them with a UNION ALL statgement like so:

    Query="SELECT * FROM Table1 
    UNION ALL SELECT * FROM Table2 
    UNION ALL SELECT * FROM Table3
    ..."

    or perform joins like so:

    SELECT *
    FROM Table1
    LEFT JOIN Table2
    ON Table1.KeyColumn=Table2.KeyColumn
    LEFT JOIN Table3
    ON Table1.KeyColumn=Table3.KeyColumn
    ...