# Synchronize 2 tables in different databases

**URL:** <https://forum.inductiveautomation.com/t/synchronize-2-tables-in-different-databases/5131>\
**Category:** Ignition\
**Created:** [September 11, 2012, 5:36pm UTC](https://forum.inductiveautomation.com/t/synchronize-2-tables-in-different-databases/5131 "2012-09-11T17:36:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvandeve](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jvandeve](https://forum.inductiveautomation.com/u/jvandeve)\
**Post date:** [September 11, 2012, 5:36pm UTC](https://forum.inductiveautomation.com/t/synchronize-2-tables-in-different-databases/5131/1 "2012-09-11T17:36:23Z")

</div>

Is there an easy way to compare two tables in different databases and return the difference ? I try to synchronize a SQL server table from IT with a MySQL table on the plant side. When the data changes in the IT table I need to update the table in the MySQL database. There is an existing connection in Ignition to both databases. I want to make sure that all items in the IT database exist in the MySQL table. Only two columns are important, an item and a description.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [September 11, 2012, 8:08pm UTC](https://forum.inductiveautomation.com/t/synchronize-2-tables-in-different-databases/5131/2 "2012-09-11T20:08:22Z")

</div>

If you do something like the following:`SELECT IT-table.* FROM IT-table
LEFT JOIN MYSQL-table
ON IT-table.id=MYSQL-table.id
WHERE ISNULL(MYSQL-table.id)`you will end up with a dataset with records from IT-table which do not exist in MYSQL-table - you will obviously have to choose what fields to join the 2 tables on.

You can then loop through the dataset and add each row into MYSQL-table.
