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

which join i need to use

hi i have two tables

table1 conatins fields

table1                    table2

field1 field2      field2  field3

A      1             

B      2               3     y

C      3               4     z

D      4               5      p

                         6     q

now i want the result  with  1,2,5,6 records of field2 in both table.

7 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Try this:

LOAD field1, field2

FROM table1;

LOAD field2, field3

FROM table2

Where not exists(field2)

;

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

Data:

LOAD field1, field2

FROM table1;

CONCATENATE(Data)

LOAD field2, field3

FROM table2

Where not exists(field2);

Regards,

Jagan.

Anonymous
Not applicable
Author

HI I TRIED THIS BUT I AM NOT GETTING THE RESULT.

I NEED THE RESULT AS

FIELD1     FIELD2     FIELD3

A               1               -

B                   2          -

-                    5          p

-                    6          q

Anonymous
Not applicable
Author

HI I TRIED THIS BUT I AM NOT GETTING THE RESULT.

I NEED THE RESULT AS

FIELD1     FIELD2     FIELD3

A               1               -

B                   2          -

-                    5          p

-                    6          q

jonathandienst
Partner - Champion III
Partner - Champion III

Do you want the data in one table? If so, use Concatenate in front of the second load.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
spividori
Specialist
Specialist

HI.

table1                    table2

field1A field1B    field2A  field2B

A      1            

B      2               3     y

C      3               4     z

D      4               5      p

                         6     q

TableResult:

load field1A as field1,

       field1B as field2

resident table1

where not exists(field2A,field1B);

concatenate

load field2A as field2,

       field2B as field3

resident table2

where not exists(field1B,field2A);

Regards.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

 

DataTemp1:

 

LOAD

field1

,  

field2

 

FROM

 

 

(

ooxml, embedded labels, table is Sheet1);

 

LEFT

JOIN

(DataTemp1) 

LOAD

field2

,  

field3

 

FROM

 

 

(

ooxml, embedded labels, table is Sheet2);

 

Data:

 

LOAD

field1

, 

field2

 

RESIDENT

DataTemp1

 

WHERE

Len

(Trim

(field3

)) = 0

;

 

DROP

TABLE

DataTemp1;

 

LOAD

field2

,  

field3

 

FROM

 

 

(

ooxml, embedded labels, table is Sheet2);

 

LEFT

JOIN

(DataTemp2) 

LOAD

field1

,  

field2

 

FROM

 

 

(

ooxml, embedded labels, table is Sheet1);

 

Data:

 

LOAD

field2

, 

field3

 

RESIDENT

DataTemp2

 

WHERE

Len

(Trim

(field1

)) = 0

;

 

DROP

TABLE

DataTemp2;

Hope this helps you.

Regards,

Jagan.