Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Viewing all articles
Browse latest Browse all 4901

Remove/mark duplicate entries, SELECT remaining unmatched--Accounting-based problem

$
0
0
I have a table with a month's worth of accounting data that I need to compare to another table with accounting data from another source. But before I can even get to that point, I need to remove what the accounting department calls the "back out" entries.My data can look like this for a particular TransactionID/AcctNo/FundNo combination:AcctNo FundNo Debit Credit TransactionIDxyz 123 0 25 abc123xyz 123 0 25 abc123xyz 123 25 0 abc123BOOr due to multiple mistakes, it can look like this:AcctNo FundNo Debit Credit TransactionIDxyz 123 0 25 abc123xyz 123 0 25 abc123xyz 123 25 0 abc123BOxyz 123 0 25 abc123xyz 123 25 0 abc123BOThe TransactionID is ultimately the big identifying key but I also have data that may not be "back outs" that look like this:AcctNo FundNo Debit Credit TransactionIDabc 456 0 25 def123abc 456 25 0 def123This data is fine to keep (for the time being--right now I'm working on a quick slap together job and will go back and refine--dealing with the "back outs" is the main issue now because I'm looking a about 100K records that have the "BO" at the end of the TransactionID).My question is how I would mark (I did add a field to my table to flag "back outs") the records that are part of the "back out?" For example:AcctNo FundNo Debit Credit TransactionIDxyz 123 0 25 abc123xyz 123 0 25 abc123 **this is the corresponding "back out" transactionxyz 123 25 0 abc123BOOrAcctNo FundNo Debit Credit TransactionIDxyz 123 0 25 abc123xyz 123 0 25 abc123 **xyz 123 25 0 abc123BOxyz 123 0 25 abc123 **xyz 123 25 0 abc123BOAny suggestions would be greatly appreciated. I've never run into this type of scenario during my entire career so this is most definitely a first--and of course, they needed it yesterday:-)Thanks.--Molly

Viewing all articles
Browse latest Browse all 4901

Trending Articles