0

There are 2 databases. Database 1 has same number tables but does not contain old record, whereas Database2 has all the records. Now I want to build a new table containing all the unmatched records between two tables.

for Ex. Table1

ID    dateCreated  doesExist
3001  12:01:12     Y
3002  15:23:08     Y

Table2

ID    dateCreated  doesExist
1001  21:09:56     N
3001  12:01:12     Y
3002  15:23:08     Y

Required new table Table3

sourceTable   DesTable       ID    dateCrated  doesExist
Table1(name)  Table2(name)   1001  21:09:56    N

So far I'm able to get the unmatched records using the outer Join condition. But how do I store that as records in new table also containing the table name of source and destination.

New table has to contain the table name of both sourceTable and destTable as there are many tables in databases.

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • SQL Server <> MySQL. What RDBMS are you *really* using? You say you've been able to achieve some of what you want; what was that attempt? Why didn't the attempt completely work? – Thom A Apr 25 '22 at 11:16
  • 1
    Does this answer your question? [LEFT JOIN vs. LEFT OUTER JOIN in SQL Server](https://stackoverflow.com/questions/406294/left-join-vs-left-outer-join-in-sql-server) – Mate Apr 25 '22 at 11:16

0 Answers0