Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Specialist
Specialist

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;

View solution in original post

10 Replies
krishnacbe
Partner - Specialist III
Partner - Specialist III

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
Specialist
Specialist

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
Author

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

krishnacbe
Partner - Specialist III
Partner - Specialist III

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
Specialist
Specialist

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
Author

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
Author

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
Specialist
Specialist

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
Partner - Specialist III
Partner - Specialist III

I agree with Aar Kay Solution to fix in Script.