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

Begginer!! Select betwwen 2 tables

Hi,

This is my first post, and as ou can see I'm a begginer with qlikview.

I have 2 TXT FILES that I load on QV.

First table contains a field CODE and Country

Second table contains Country - FROM CODE - TO CODE - Status.

I need to insert on first table STATUS where CODE Between From Code and TO CODE and Table1.Country = Table2.Country.

Can someone help me giving me a code example?

Best regads.

4 Replies
gajapathy74
Creator II
Creator II

Hi,

If you could upload your files, then it would be easier to get the solution.

Regards,

jagan
Luminary Alumni
Luminary Alumni

Hope this script help you

A:
LOAD * INLINE [
Country, Code
1, 10
2, 20
3, 30
4, 40
];

B:
LOAD * INLINE [
Country, FromCode, ToCode, Status
1, 10, 30, Yes
2, 30, 40, Yes
3, 10, 40, No
4, 30, 40, No
];

//Inserts Code in Table B
INNER JOIN (B)
LOAD
*
RESIDENT
A;

Temp:
LOAD
Country,
Code,
Status
RESIDENT
B
WHERE
Code>=FromCode AND Code<=ToCode;

Drop table A;
Drop table B;

Regards,

Not applicable
Author

Case A is not between Table B Codes,

Is visible that record on new table?

Best regards,

Not applicable
Author

I have tested with that data and not all from A apeears on TEMP

Example:

A

Contry,Code

1,20

2,25

Table B

Country, From, To, Status

1,10,25,OK

Second Reg from A Doesn't Appear on new table.

How to get all data and only fill the new field where Condition is acomplished

Example

Country,Code,Status

1,20,OK

2,25,