Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Select data from two tables

Hi Guys,

i have two tables like these:

 

A
B
1Y
2Y
3N

A
1
4
5

I'd like to have something like this:

A
B
1Y
2Y
3N
4
5

 

Can you help me please?

1 Solution

Accepted Solutions
aarkay29
Valued Contributor

Re: Select data from two tables

Table:

LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Join (Table)
LOAD *
INLINE [
A
4
5
]
;

Noconcatenate

Load A,

     If(Isnull(B),'N',B) as B

resident Table;

Drop Table Table;

10 Replies
krishnacbe
Valued Contributor III

Re: Select data from two tables

Hi,

Simple Load will create the result table. Try below code.

Table1:
LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Table2:
LOAD * INLINE [
A
4
5
]
;

aarkay29
Valued Contributor

Re: Select data from two tables

Use Join statement to join the table

Table:
LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Join (Table)
LOAD *
INLINE [
A
4
5
]
;

Not applicable

Re: Select data from two tables

Values 4 and 5 in column A should have "N" in column B of table RESULT; Sorry, i didn't specify it

krishnacbe
Valued Contributor III

Re: Select data from two tables

You can use below expression in Script or Chart to replace the Null values with N

if(isnull(B) or Len(B)=0,'N', B)

aarkay29
Valued Contributor

Re: Select data from two tables

If you have no specific logic to specify N or Y and just want to give 'N' for the second table then

Table:
LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Join (Table)

LOAD A, 'N' as B;

LOAD * INLINE [

A
4
5
]
;

Not applicable

Re: Select data from two tables

In your answers you make:

LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Join (Table)
LOAD *
INLINE [
A
4
5
]
;


I can't delete value 1 from second table

Not applicable

Re: Select data from two tables

i'have to make a full outer join from first and second table and then make a condition to set null values in column B (table of results) as "N"

aarkay29
Valued Contributor

Re: Select data from two tables

Table:

LOAD * INLINE [
A, B
1, Y
2, Y
3, N
]
;
Join (Table)
LOAD *
INLINE [
A
4
5
]
;

Noconcatenate

Load A,

     If(Isnull(B),'N',B) as B

resident Table;

Drop Table Table;

krishnacbe
Valued Contributor III

Re: Select data from two tables

I agree with Aar Kay Solution to fix in Script.