SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2013
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone help me with finding duplicate records in a table?

    can someone help me with findin duplicate record in a table ?
    most probably everything right but got a doubt while testing today...

    i shud have taken care of this while creating but anyhow ... i have this table called pattern

    Code:
    pno auto inc, primary key
    s1,
    s2,
    s3,
    s4,
    s5,
    s6,
    s7,
    s8 
    - all 8 field are off the type INT and have the permission to repeat and can also have a NULL value
    what i want to check is,
    > if more than one record has same value of 8 all fields...

    if possible, try to give the query itself...

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Code:
    SELECT s1
         , s2
         , s3
         , s4
         , s5
         , s6
         , s7
         , s8 
      FROM pattern
    GROUP
        BY s1
         , s2
         , s3
         , s4
         , s5
         , s6
         , s7
         , s8 
    HAVING COUNT(*) > 1
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2013
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no duplicates found!
    thanks for the help...


Bookmarks

Posting Permissions

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