Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to create the cartesian product by joining two tables. Table1 is read into QV from a database and the other is generated internally within QV. An example of what I would like to do is:
Table1
Field1 Field2 Field3
1 A 22
2 B 71
Table2
Field2
A
B
C
The "join" should result in the following table
Field1 Field2 Field3
1 A 22
1 B -
1 C -
2 A -
2 B 71
2 C -
Any suggestions on how this can be done?
Thanks,
/HJ
Hi, you can use simple JOINs for it. But i think, this just works for small amount of data. For your example:
LOAD
Field1
FROM
Table1;
OUTER JOIN
LOAD Field1 AS Field2
FROM
Table2;
LEFT JOIN
LOAD
Field1,
Field2,
Field3
FROM
Table1;
Kind regards.
Hi, you can use simple JOINs for it. But i think, this just works for small amount of data. For your example:
LOAD
Field1
FROM
Table1;
OUTER JOIN
LOAD Field1 AS Field2
FROM
Table2;
LEFT JOIN
LOAD
Field1,
Field2,
Field3
FROM
Table1;
Kind regards.
Thanks!!!
It worked like a charm. The only modification I did was to add a distinct option to the first load statement.
LOAD DISTINCT Field1
FROM
Table1;
OUTER JOIN
LOAD Field1 AS Field2
FROM
Table2;
LEFT JOIN
LOAD
Field1,
Field2,
Field3
FROM
Table1;
Many thanks!
/HJ