Hello Sanoj,

We hope you are doing well.

Please go through the below commands carefully:

A = LOAD '/home/edureka/Desktop/Data01.txt' USING PigStorage(',') AS (Fname:chararray,ID:int,Company:chararray,City:chararray);

B = LOAD '/home/edureka/Desktop/Data02.txt' USING PigStorage(',') AS (ID:int,lname:chararray,Marks:chararray,Country:chararray);

result1 = JOIN A BY ID, B BY ID;

DUMP result1;

result2 = GROUP result1 BY Marks;    

DUMP result2;


result3 = ORDER result2 by $0 DESC;     

DUMP result3;


result4 = LIMIT result3 1;     

DUMP result4;


describe result4;    

 Since City and Fname is in relation A,so to access these attributes we have used A::City,A::Fname

and Marks is in relation B so we have used B::Marks.                                

final_result = FOREACH result4 GENERATE $1.A::City,$1.A::Fname,$1.B::Marks;

DUMP final_result;

We hope it will help you resolve the issue.

If you have any further query,please let us know.