SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need records where empid having duplaicates

    Hi,


    10 sunil S/E
    20 ravi T/E
    30 naga S/E
    40 john T/E
    10 steven S/E
    30 ravi T/E

    I need ouput as,

    10 sunil S/E
    10 steven S/E
    30 naga S/E
    30 ravi T/E

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Code:
    SELECT
        t1.id
      , t1.name
      , t1.whatever
    FROM tablename AS t1
    INNER JOIN
      (SELECT id
       FROM tablename
       GROUP BY id
       HAVING COUNT(*) > 1
      ) AS t2
    ON t1.id = t2.id


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
  •