Deleting Records

  • Hi,

    I have one question..I have one table named emp, which contains onw column called emp_name..and that coloumn contais following records

    Sam

    Tam

    Ram

    Dam

    Zam

    Sam

    Sam

    Tam

    As it shows I have some duplicate records in this . Now I just want to delete only the duplicate records i.e. if I have 4 Sam's then only three should get deleted .

    Thanks in advance

  • Have a look at this link: http://www.sqlservercentral.com/faq/viewfaqanswer.asp?categoryid=3&faqid=138

    It should give you some ideas.

    Jeremy

  • you could do the following

    select distinct emp_name from emp

    and use the results to create a new table

    eg

    create table new_emp(emp_name varchar(100))

    insert into

    new_emp

    select distinct

    emp_name

    from

    emp

    Edited by - shoayb on 10/10/2003 01:39:51 AM

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply