Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
Employee
Employee

Re: Load Multiple Tables

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;

dagomezl
Contributor III

Re: Load Multiple Tables

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

MVP & Luminary
MVP & Luminary

Re: Load Multiple Tables

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