Results 1 to 3 of 3

Thread: sql problem

  1. #1
    Join Date
    Apr 2003
    Location
    UK
    Posts
    2,560

    sql problem

    hi all,

    using oracle, im trying to find records that have more than 1 corresponding record in teh same table if that makes any sense at all..

    a query such as:

    i was thinking something like select field1, count(field2) from table where count(field2) > 1 group by field1

    it should be a 1:1 field1:field2 but theres reason to believe field2's are not unique..

    Thanks in advance

  2. #2
    Join Date
    Aug 2001
    Location
    Ontario, Canada
    Posts
    25
    You need to group by field2 as well for the count to work properly.

  3. #3
    Join Date
    Apr 2005
    Posts
    42
    try

    select field1, count(field2) as counter
    Group By field1
    Having counter > 1

Posting Permissions

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