I am receiving funny results from a query. To simplify, I have 2 tables (today\yesterday). Each tbl has the same 8 columns. My query joins the two tables then looks where either of two columns has changed. What is happening is that when checking one of the columns it seems as though sql is flipping the column, causing it to be returned in error.
colA colB colC colD colE colF colG colG (from yesterday)
1 1 a b c d e m
1 1 a b c d m e
So what's happening is that the record above is actually the same record and should not be returned. There is a daily pmt column that changes but I am not using that in the query. Aside from that the two records are identicle.
There aren't defined keys, but colA and colB combined make the key. The key is not unique though as there could be multiple records. To make the key unique it would have to include both colF and colG but then these are subject to change (which is what I am checking).
If it is not unique, it is not a key. And if you are joining on this and there are duplicates, then you will get duplicate records out. If you have two records in A that match with 2 records in B, you are going to get 4 records as a result. There is no way around that.
If it's not practically useful, then it's practically useless.