Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load Multiple Tables

I am new to QlikView and I am attempting to load multiple tables from an odbc database into a QV application.  I can manage to load one table but when I try to load another, it overwrites the first one.  How can I get multiple tables into an application?

3 Replies
Clever_Anjos
Employee
Employee

ODBC CONNECT TO [MS Access Database;DBQ=F:\DropBox\Dropbox\Backup Note\Apostilas\Nwind.accdb];

LOAD CategoryID,

    CategoryName,

    Description,

    Picture;

SQL SELECT *

FROM Categories;

LOAD ProductID,

    ProductName,

    SupplierID,

    CategoryID,

    QuantityPerUnit,

    UnitPrice,

    UnitsInStock,

    UnitsOnOrder,

    ReorderLevel,

    Discontinued;

SQL SELECT *

FROM Products;

Anonymous
Not applicable
Author

Yeah is possibilite

Tabla1:

Load campo1,

      campo2,

      campo3;

SQL Select *

from Tabla1;

Tabla2:

Load campo1,

      campo2,

      campo3,

      campo4;

SQL Select *

from Tabla2;

The end see 2 tables

PD: sorry for my english

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Barbara,

This implies to me that the structure of both of the tables you are loading is identical (ie. the field list is exactly the same)?

What QlikView does in this case is concatenate all the data from the second table in the first - so the data model will show you only one table but you will have the data from both in there.  The name of the combined table will be the name you gave to the first table - any renaming of the second table is ignored.

This seems a bit strange if you are coming from a RDBMS background - but it makes perfect sense in QlikView and is probably the best way to have your data model.

You can stop this auto concatenate by using a NOCONCATENATE function, but this will lead to issues in your data model (synthetic keys).  The better way if you need the tables separate is to rename the fields in one of the tables, leaving just one field the same - this will become the join key.  For example:

Tab1:

LOAD
   A,

    B,

    C

   ;

SQL SELECT A, B, C

FROM Table1

;

Tab2:

LOAD
   A,

   B as B2,

   C as C2

   ;

SQL SELECT A, B, C

FROM Table2

;

This will give you two tables, joined on the field A.  If you want to join on multiple fields then you should build a composite key.

If you Google on QlikView Data Model Best Practices then you will find lots of information on the above.

Kind regards,

Steve