Avatar of pda4me
pda4me

asked on 

MySQL compare 2 table match columns

i have two tables Table1 and Table2 each with different column names but housing the same data.  Table 1 has a primary key called MLNUM and Table 2 has a primary key called MLSNUMBER for example but both contain a record with a matching value for their columns example: 201104995.

If I use a value that is found in both tables as the primary key (example: 201104995)  how can I compare the two tables and get the names of columns where the data matches for that record in each table..

For example, if I use 201104995, I can manually match up that column City in Table1 and column ListingCity in Table2 as both have the same data.

There is close to 100 columns in each table so this is very hard to do manually.  How can save some work and do this with a query?
MySQL ServerSQL

Avatar of undefined
Last Comment
Aaron Tomosky
Avatar of pda4me
pda4me

ASKER

to clarify, I want to see out put like this

Table1-columnName-->Table2-columnName-->Matching Data
ASKER CERTIFIED SOLUTION
Avatar of Aaron Tomosky
Aaron Tomosky
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SQL
SQL

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

61K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo