def merge_tables(table1, table2,join_type='exact'):
    """Merges two RMTables into a single table.
    Inputs: table1 (RMTable): first table to be merged.
            table2 (RMTable): second table to be merged.
            join_type (str): 'exact' - requires both tables have exactly the same columns.
                             'inner' - only columns common to both.
                             'outer' - keep all columns, masking any missing from one table.
    """
    new_table=table1.copy() #Copy old table to avoid affecting that variable.
    new_table.update_details()
    new_table.append_to_table(table2,join_type=join_type)
    return new_table