I am trying to write a query that would delete duplicate records. I tried to use the find duplicate query but I have 13 columns that exceed the 10 field max from the find dup query.
I tried to set the unigue records to no but this didnt help either.
I have created a second table for these records to go into. Right now when I run this query I get no records returned. Which I believe I should have at least 800 dups.
The fields that I need to check for dups are: PostPeriod, PayCode, Provider, ServicePeriod,InvoiceCreationPeriod,CPT,Volume,ChargeAmt,PaymentAmt,AdjustmentAmt,DebitAmt,CreditAmt.
I tried to set the unigue records to no but this didnt help either.
I have created a second table for these records to go into. Right now when I run this query I get no records returned. Which I believe I should have at least 800 dups.
The fields that I need to check for dups are: PostPeriod, PayCode, Provider, ServicePeriod,InvoiceCreationPeriod,CPT,Volume,ChargeAmt,PaymentAmt,AdjustmentAmt,DebitAmt,CreditAmt.
Code:
SELECT dbo_BWF_exp_File.PostPeriod, dbo_BWF_exp_File.PayCode, dbo_BWF_exp_File.Provider, dbo_BWF_exp_File.ServicePeriod, dbo_BWF_exp_File.InvoiceCreationPeriod, dbo_BWF_exp_File.CPT, dbo_BWF_exp_File.Volume, dbo_BWF_exp_File.ChargeAmt, dbo_BWF_exp_File.PaymentAmt, dbo_BWF_exp_File.UCI, dbo_BWF_exp_File.AdjustmentAmt, dbo_BWF_exp_File.DebitAmt, dbo_BWF_exp_File.CreditAmt
FROM dbo_BWF_exp_File
WHERE (((dbo_BWF_exp_File.PostPeriod) In (SELECT [PostPeriod] FROM [dbo_BWF_exp_File] As Tmp GROUP BY [PostPeriod],[PayCode],[Provider],[ServicePeriod],[InvoiceCreationPeriod],[CPT],[Volume],[ChargeAmt],[PaymentAmt] HAVING Count(*)>1 And [PayCode] = [dbo_BWF_exp_File].[PayCode] And [Provider] = [dbo_BWF_exp_File].[Provider] And [ServicePeriod] = [dbo_BWF_exp_File].[ServicePeriod] And [InvoiceCreationPeriod] = [dbo_BWF_exp_File].[InvoiceCreationPeriod] And [CPT] = [dbo_BWF_exp_File].[CPT] And [Volume] = [dbo_BWF_exp_File].[Volume] And [ChargeAmt] = [dbo_BWF_exp_File].[ChargeAmt] And [PaymentAmt] = [dbo_BWF_exp_File].[PaymentAmt])))
ORDER BY dbo_BWF_exp_File.PostPeriod, dbo_BWF_exp_File.PayCode, dbo_BWF_exp_File.Provider, dbo_BWF_exp_File.ServicePeriod, dbo_BWF_exp_File.InvoiceCreationPeriod, dbo_BWF_exp_File.CPT, dbo_BWF_exp_File.Volume, dbo_BWF_exp_File.ChargeAmt, dbo_BWF_exp_File.PaymentAmt;