10 Replies Latest reply: Mar 28, 2017 10:41 AM by giuseppe alleruzzo

# 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

• ###### Re: Select data from two tables

Hi,

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

Table1:
A, B
1, Y
2, Y
3, N
]
;
Table2:
A
4
5
]
;

• ###### Re: Select data from two tables

Use Join statement to join the table

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

• ###### 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

• ###### 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)

• ###### 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:
A, B
1, Y
2, Y
3, N
]
;
Join (Table)

A
4
5
]
;

• ###### Re: Select data from two tables

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

I can't delete value 1 from second table

• ###### 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"

• ###### Re: Select data from two tables

Table:

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

Noconcatenate

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

resident Table;

Drop Table Table;

• ###### Re: Select data from two tables

I agree with Aar Kay Solution to fix in Script.

• ###### Re: Select data from two tables

Thank you so much; i made a mistake:

Operatori:

TIPOLOGIA_OPERATORE

FROM

[E:\PROGETTI_QLIKVIEW\MOSA\Tipo_Operatore.xls]

(biff, embedded labels, table is [Scarica foglio di lavoro\$]);

join(Operatori)

SQL SELECT * FROM TBL_EVENTI E

WHERE E.EVENTO_CREATO_DA NOT IN (SELECT operatore FROM tb_sospensioni S WHERE S.inizio_sospensione <= E.EVENTO_CREATO_IL AND S.fine_sospensione >= E.EVENTO_CREATO_IL);

NoConcatenate