Hi,
I have a requirement where I want to compare data from two tables and display only the columns if they is a mismatch using sql query.
Say userid, email and phone number of the same employee are stored in two tables. Now I want to compare the data of email and phone number from both the tables and display email and phone number only if they are different data.
employee table:
user_details table:
Please note that the two tables have completely different column names and the data can contain null value as well. What I want to achieve is compare the data of the same employee across the two tables and display the columns which have different value in user_details table; like:
As the table column names are different, I cannot use a join and minus to find out the difference. I tried this with using CASE after the WHERE clause for multiple column comparison but OR or AND both would defy the condition of displaying all columns with different data for the same row.
How do I achieve this without creating a separate view or table as I do not have a write access? Any pointers would be helpful.
-Thanks.