Need help with a query involving flagging duplicate records.
I have a table named "Purchases" which has records related to a customers purchases. Each record entry for a customer is uniquely identified by their Social Security number. attached is the scripted database.
I need a query that will peform the following below. Can someone please help me out?
Set the "Active" flag to 1 where the DUP_PARAM = 2 and the MoneyAmount is the largest value (Max) for any one customer.
For those customer records that do not have the Max MoneyAmount, and do have DUP_PARAM=2, then set the ActiveFlag = 9.
Also for the records that do not have DUP_Param = 2, then just ignore those records.