-1

I have two same tables residing in two different database libraries. Both the tables have around 150 columns. At any point of time there will be only one record/row in both the tables. I need to run a query which will return only the unmatched columns using SQL.

For Example: Table1

cmp env cust area  name.. ... ... ... 
ABC SUN XXXX EARTH xyz

Table2

cmp env cust area   name.. ... ... ... 
ABC MOON XXXX EARTH uvw

Can I get a result like this:

       env  name .. .. ... 
Table1 SUN  xyz 
Table2 MOON uvw

Thank you!!

Rahul
  • 76,197
  • 13
  • 71
  • 125
Sunitha
  • 1
  • 1
  • See this link hope it will help http://stackoverflow.com/questions/11767565/mysql-select-rows-from-a-table-that-are-not-in-another – Ramzan Mahmood Dec 09 '16 at 13:00

1 Answers1

0

The answer is: no, it is not possible to list unmatched columns only in the resultset. The reason is that you need to include all columns you would like to display in the select list before you run the query. You can exclude records from the output using various filters, but not fields.

Obviously, in an application you can hide those columns in the user interface where you know that the field values do match, since at that time you already know what the underlying data is.

Shadow
  • 33,525
  • 10
  • 51
  • 64