21.01.2013 Views

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Forced Concatenation<br />

If two or more tables do not have exactly the same set of fields, it is still possible to force <strong>QlikView</strong> to concatenate<br />

the two tables. This is done with the concatenate prefix in the script, which concatenates a table<br />

with another named table or with the last previously created table.<br />

Example:<br />

load a, b, c from table1.csv;<br />

concatenate load a, c from table2,csv;<br />

The resulting internal table has the fields a, b and c. The number of records in the resulting table is the sum<br />

of the numbers of records in table 1 and table 2. The value of field b in the records coming from table 2 is<br />

NULL.<br />

Rules:<br />

l The names of the fields must be exactly the same.<br />

l Unless a table name of a previously loaded table is specified in the concatenate statement the concatenate<br />

prefix uses the last previously created table. The order of the two statements is thus not arbitrary.<br />

Preventing Concatenation<br />

If the field names and the number of fields of two or more loaded tables are exactly the same, <strong>QlikView</strong> will<br />

automatically concatenate the content of the different statements into one table. This is possible to prevent<br />

with a nonconcatenate statement. The table loaded with the associated load or select statement will then not<br />

be concatenated with the existing table.<br />

Example:<br />

load a, b, c from table1.csv;<br />

nonconcatenate load a, b, c from table2.csv<br />

26.8 Join and Keep<br />

It is possible to join tables already in the script. The <strong>QlikView</strong> logic will then not see the separate tables,<br />

but rather the result of the join, which is a single internal table. Sometimes this is preferable, sometimes even<br />

necessary, but most of the time it is not advisable, since:<br />

l The loaded tables often become larger, and <strong>QlikView</strong> works slower.<br />

l Some information may be lost: the frequency (number of records) within the original table may no<br />

longer be available.<br />

The keep functionality, which has the effect of reducing one or both of the two tables to the intersection of<br />

table data before the tables are stored in <strong>QlikView</strong>, has been designed to reduce the number of cases where<br />

explicit joins needs to be used. .<br />

Note!<br />

In this manual the term join is usually used for joins made before the internal tables are created. The association,<br />

made after the internal tables are created, is however essentially also a join.<br />

Joins within an SQL Select Statement<br />

With some ODBC drivers it is possible to make a join within the select statement. This is almost equivalent<br />

to making a join using the join prefix.<br />

However, most ODBC drivers are not able to make a full (bidirectional) outer join. They are only able to<br />

make a left or a right outer join. A left (right) outer join only includes combinations where the joining key<br />

370

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!