Results 1 to 2 of 2

Thread: Duplicates

  1. #1
    Join Date
    Feb 2004
    Posts
    11

    Unanswered: Duplicates

    I have to write a query which extracts everyone from a table who has the same surname and forenames as someone else but different id's.

    The query should have a surname column, a forenames column, and two id columns (from the person column of the table).

    I need to avoid duplicates i.e. the first table id should only be returned in the first id column and not in the second - which is what i am getting at the mo.

    This is what i have done

    select first.surname, first.forenames, first.person, second.person
    from shared.people first, shared.people second
    where first.surname= second.surname
    and first.forenames = second.forenames
    and not first.person = second.person
    order by first.surname, first.forenames

    and i get results like this

    Porter Sarah Victoria 9518823 9869770
    Porter Sarah Victoria 9869770 9518823 - i.e. duplicates

    cheers

  2. #2
    Join Date
    Feb 2004
    Posts
    11
    i have received help from the sql forum and have got it to work. Thanks

Posting Permissions

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