Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ALL,
I need to compare two columns in a table,
| FIELD1 | Field2 |
| A | Z |
| B | B |
| C | X |
| D | Y |
| E | T |
| N | M |
| O | O |
I want the result should be like this
| FIELD1 | Exists | Field2 |
| A | Exists in Field1 | |
| Exists in Field2 | Z | |
| B | Exists in Both | B |
| C | Exists in Field1 | |
| Exists in Field2 | X | |
| D | Exists in Field1 | |
| Exists in Field2 | Y | |
| E | Exists in both | E |
any help would be appreciated.
Thank you!
Hi @sjar1290
If it understand the request you will need something like this.
Temp:
LOAD
Field1,
Field2,
IF(Field1 = Field2,1,0) as Flag
From ...
Noconcatenate
Final:
Load
Field1
Resident Temp
Where Flag =0;
Concatenate
Final:
Load
Field2
Resident Temp
Where Flag =0;
Final:
Load
Field1,
Field2,
Resident Temp
Where Flag =1;
Drop Table Temp;