# Database Discussions > MySQL >  Foreign key to two tables

## robertolos

Hi, first of all I'm sorry for my bad English but I'm Italian.
I've a table X with a reference key to the id of another table A. For bakup motivation, every two days I've to move the data from table A to another identical table but named B. If I'm doing this, I've the problem that the table x no more find the entries in the table A and consequently return a reference error.
The provisional solution that I've found it's to remove the foreign key from the table X. Can you advise a better solution?
Thanks

----------


## Civic1986

you can take the snapshot of the Table A into Table B so that the data will be present in both the tables

----------


## robertolos

Yes but with this solution I've duplicated data.

----------


## paullopez

I think you need to reference the ID of table X in table B and A. You will need to define two foreign keys for table B and each foreign key should point to the required fields of one table. It means one foreign key per foreign table.

----------

