I am not a databases guy,but I have been given the "fun" job of cleaning up someone else's database. We have many duplicate record in our databases and some of customers are getting double or triple billed every month.
Given the following Database example :
Table:  Customers
ID       Name        Phone          DoNotBill
1        Acme Inc    5125551212     No
2        ABC LLC     7138221661     No
3        Big Inc     4132229807     No
4        Acme        5125551212     No
5        Tree Top    2127657654     No
Is it possible to write a query that Identifies the all duplicate phone numbers (in this case records 1 and 4) and then marks and duplicate records yes by updating the DoNotBill column. But leaves the first record unmarked.
In this example case we would be left with:
ID       Name        Phone          DoNotBill
1        Acme Inc    5125551212     No
2        ABC LLC     7138221661     No
3        Big Inc     4132229807     No
4        Acme        5125551212     Yes
5        Tree Top    2127657654     No
 
     
     
     
    