Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

David Branscome

@David Branscome
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Display Duplicate Rows Only once
    D David Branscome

    -- ALWAYS TEST FIRST -- I don't have your table name -- REPLACE "TABLE" WITH THE ACTUAL TABLE NAME -- Try this to select the dups select count(*),FirstName , LastName , City from "TABLE" group by FirstName , LastName , City having count(*) > 1 -- select the data into another table and TEST THIS -- REPLACE "TABLE" WITH THE ACTUAL TABLE NAME --*********************** DELETE DUPS *************************************** -- the Magic is in the rowcount setting!!! make sure it is set to 1 at the start and 0 on completion set rowcount 1 while exists (select FirstName,LastName,City from "TABLE" group by FirstName , LastName , City having count(*) > 1) begin delete T from "TABLE" T inner join (select FirstName,LastName,City from "TABLE" group by FirstName,LastName,City having count(*) > 1) dup on T.FirstName = dup.FirstName and T.LastName = dup.LastName and T.City = dup.City end go set rowcount 0 go Good Luck DBranscome Phoenix AZ David Branscome

    modified on Tuesday, February 12, 2008 7:19 PM

    Database database tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups