comparison key in related table
I want to compare two tables(lets call them tblPeople). The datasets have a column 'Id' which is linked to another table(tblRegistry). The Id columns are not the same in the two databeses but in every db itself the Id in tblPeople matches the Id in tblRegistry. The tblRegistry has a column XId. So every dataset in tblPeople is connected via the Id to a XId in tblRegistry and the XIds are matching overall the two databases.
Now I want to compare the tables tblPeople with the comparison key XId from tblRegistry.
How can I do that and is it possible via commandline?