Here is a simple example of how to do this. I am not sure of what the final combined data table is, so I guessed it had to be a concatenation.
names default to here(1);
dtA = Open("$SAMPLE_DATA\Big Class.jmp");
dtB = Open("$SAMPLE_DATA\Big Class Families.jmp");
dtACol = New Table("A Columns", private,
New Column("A", character, values(dtA<<get column names))
);
dtBCol = New Table("B Columns", private,
New Column("B", character, values(dtB<<get column names))
);
dtJoin = dtACol << Join( private,
With( dtBCol ),
By Matching Columns( :A = :B ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
CommonColList = dtJoin:A << getvalues;
dtAsubset = dtA << subset( private, selected rows(0), columns(CommonColList));
dtBsubset = dtB << subset( private, selected rows(0), columns(CommonColList));
dtFinal = dtAsubset << Concatenate( dtBsubset );
Jim