Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have two tables in an SQL database.
One contains records, and looks a bit like this:
ID number | Description | Resolution | Assigned Agent |
---|---|---|---|
1 | Forgotten password. | User given new password. | Hans |
2 | User complains about loud beeping noise. | User had two keyboards and was using one to put things on. | Gretel |
4 | User cant find printer. | Guided the user, printer was on his desk. | Tits McGee |
The other one contains multiple rows of data for each record in the first table, like this:
ID Number | Action Type | Date |
---|---|---|
1 | Record Opened | 2014-01-01 |
1 | Description Changed | 2014-01-04 |
1 | Record Closed | 2014-01-11 |
3 | Record Opened | 2014-01-23 |
4 | Record Opened | 2014-02-09 |
5 | Record Opened | 2014-03-11 |
Now, what I want to do is import the entire first table, and then get the rows with the corresponding ID-numbers from the second table and store into a seperate table in quickview.
In other words, somthing like this:
Facts:
LOAD
[ID number];
SQL Select
[ID number]
FROM
Table1;
Details:
LOAD
[Action Type];
SQL Select
[Action Type]
FROM
Table2
WHERE
table2.[ID number] in Facts;
However, I get an error message complaining about incorrect syntax.
Is it possible to use a value from a previous LOAD in the next SQL WHERE statement? The WHERE-statement is in the SQL-query so I was thinking I should be using SQL-syntax and not Qlikview's funtions. Perhaps I'm doing it completely wrong? I need to keep the data in seperate tables once loaded into qlikview, no joins.
I'm guessing I could also just get the entire Table2 in the SQL Select and then limit my data in the LOAD with the match() function or something, but wouldn't that put a bigger strain on my database server? The real tables are millions of rows each.
Thanks in advance.
Thank you very much for your responses, I wish I could mark them all as correct
I used LEFT KEEP before the second load and it did exactly what I needed.
This is my finished load-script:
Facts:
LOAD
[ID number];
SQL Select
[ID number]
FROM
Table1;
Details:
LEFT KEEP LOAD
[ID Number],
[Action Type];
SQL Select
[ID number],
[Action Type]
FROM
Table2
This answered my question, thank you very much!
Thank you! Left keep was the solution!