Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vishnus85
Partner - Creator
Partner - Creator

Urgent : Doubt in Load statement

Hi All,

I have two resident tables sa A and B both having student_id field as common.

I need to devise a load statement to create a table C such as

C:

LOAD *

RESIDENT A

WHERE student_id in

(LOAD student_id

RESIDENT B);

just like we use in select statements like -- select * from table A where student_id in (select student_id from table B)

I know that the above code is wrong and ofcourse it is not working.

Please help me to find a solution for my requirement.

Regards,

Vishnu S

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi Vishnu,

I'd do as follows:

B:

LOAD student_id

FROM FileB.qvd (qvd); // or whatever the source

A:

LOAD *

FROM FileA.qvd (qvd)

WHERE Exists(student_id); // will load only records where student_id is in table B

DROP TABLE B;

Hope that helps.

Miguel

View solution in original post

3 Replies
tresesco
MVP
MVP

Use INNER JOIN like:

C:

LOAD *

RESIDENT A;

INNER JOIN

LOAD student_id

RESIDENT B;

Miguel_Angel_Baeyens

Hi Vishnu,

I'd do as follows:

B:

LOAD student_id

FROM FileB.qvd (qvd); // or whatever the source

A:

LOAD *

FROM FileA.qvd (qvd)

WHERE Exists(student_id); // will load only records where student_id is in table B

DROP TABLE B;

Hope that helps.

Miguel

Not applicable

Just like Miguel said, doing as he mention you get one more advantage... all LOAD statements are optimezed.