Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:40:37+00:00 2026-06-13T12:40:37+00:00

Trying to do a diff of 2 tables with same data layout and have

  • 0

Trying to do a diff of 2 tables with same data layout and have mismatch records on sameline

Table1                   Table2
------                   ------

CUSTOMER PART            CUSTOMER  PART

CUSTID1  PART1           CUSTID1  PART1
CUSTID1  PART2           CUSTID1  PART2
CUSTID1  PART3           CUSTID1  PART3
CUSTUD1  PART4


SELECT T1.CUSTID, T1.PART, T2.CUSTID, T2.PART FROM TABLE1 AS T1
LEFT JOIN TABLE2 AS T2 ON T1.CUSTID = T2.CUSTID
WHERE  T1.PART <>  T2.PaRT
ORDER BY T1.CUSTID 

Sometimes the output look like below – it shows a mismatch when there isn’t one.
CAn I order the tables before the join to get the data to line up ?

Thanks

CUSTID1  PART1           CUSTID1  PART3
CUSTID1  PART2           CUSTID1  PART1
CUSTID1  PART3           CUSTID1  PART2
CUSTUD1  PART4           NULL     NULL
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:40:37+00:00Added an answer on June 13, 2026 at 12:40 pm

    You need to do something like:

    SELECT T1.CUSTID, T1.PART, T2.CUSTID, T2.PART 
    FROM TABLE1 AS T1 
         INNER JOIN TABLE2 AS T2 ON T1.CUSTID = T2.CUSTID 
    WHERE T1.PART <> T2.PaRT
    

    There’s no need to use left outer join. The order by clause doesn’t make any difference in result of join; it just orders the result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to process data obtained from a run of diff to an instance
I am trying to get the diff between two nearly identical tables in postgresql.
I have a query select abc from table1 union select def from table2 I
Same as oracle diff: how to compare two tables? except in mysql. Suppose I
I have two files I've been trying to compare with diff. The files are
I'm trying to run a liquibase diff operation on two tables. The operation appears
I'm trying to diff two strings by phrase, similar to the way that StackOverflow
Just trying to get diff to work better for certain kinds of documents. With
I am trying to get git diff to work on Windows 7 64 bit.
I'm trying to do a very simple thing: Read a diff from a git

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.