Forum Discussion

JWS64's avatar
JWS64
Copper Contributor
Mar 07, 2021

Two exact files - but they don't match

I've written a SELECT DISTINCT query, comparing FileA to FileB, WHERE all fields (7) of both files must match. The ORDER BY is on ID and Dates. I should see a list of all the records from FileA, but the results drop all the records of certain IDs – a total of 943 records from the 5697 total. Any ideas why?

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor
    Not without seeing the data. And not without seeing the actual SQL.
    What does the term "files" mean in this context, by the way?
    • JWS64's avatar
      JWS64
      Copper Contributor

      George_Hepworth 

      My thanks for your comment. I realized that there was a null condition that I hadn't accounted for. All good now. Thanks, again, for taking the time to respond.

       

      PS> by "files", I was referring to the Tables I use. Sorry for the confusion. I was once a mainframe programmer.

      • George_Hepworth's avatar
        George_Hepworth
        Silver Contributor
        Congratulations on spotting the discrepancy. Nulls are tricky little devils.
        Continued success with the project.
  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor
    I can venture a guess as to the explanation, based on this comment "... all fields (7) of both files must match." It would appear that in those records, that is not the case, one or more of those fields differs between the two tables. It may be worthwhile to identify one candidate of that group of 943 records and study it in detail in both tables.

Share

Resources