Results 1 to 12 of 12

Thread: Removing duplicates

Threaded View

  1. #1

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Removing duplicates

    I have this SQL statement to find duplicate rows in a table....
    SQL Code:
    1. select A, B, count(*) as count
    2. FROM table
    3. group by A, B
    4. having count>1

    The table being queried also has an int field named Version which is unique for the grouped records.

    Can some please show me how to take those results and remove the duplicate the has the lowest version?

    For example if the result is

    A|B|count
    a|b|2


    then there are 2 records that could look like this

    A|B|version
    a|b|1
    a|b|2

    I need to remove the record where version = 1

    Thanks for looking
    Kevin
    Last edited by kebo; Jun 23rd, 2018 at 08:21 AM.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width