Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Use INNER JOIN like:
C:
LOAD *
RESIDENT A;
INNER JOIN
LOAD student_id
RESIDENT B;
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
Just like Miguel said, doing as he mention you get one more advantage... all LOAD statements are optimezed.