Duplicates only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiss07
    Banned
    New Member
    • Jan 2007
    • 99

    Duplicates only

    HI ,

    I have a table .It contains empid column

    It has following

    empid name

    1 richol

    2 charles

    3 michls

    1 chola

    2 uptip

    3 arun

    4 mukil



    i require output in empid except emp id 4:


    1

    2

    3

    1

    2

    3

    i want duplicate empid onlt. How can i do it?


    arun
  • kiss07
    Banned
    New Member
    • Jan 2007
    • 99

    #2
    Duplicates only

    HI ,

    I have a table .It contains empid column

    It has following

    empid name

    1 richol

    2 charles

    3 michls

    1 chola

    2 uptip

    3 arun

    4 mukil



    i require output in empid except emp id 4:


    1

    2

    3

    1

    2

    3

    i want duplicate empid . How can i do it?


    arun

    Comment

    • Mani kansal
      New Member
      • Apr 2007
      • 11

      #3
      Originally posted by kiss07
      HI ,

      I have a table .It contains empid column

      It has following

      empid name

      1 richol

      2 charles

      3 michls

      1 chola

      2 uptip

      3 arun

      4 mukil



      i require output in empid except emp id 4:


      1

      2

      3

      1

      2

      3

      i want duplicate empid . How can i do it?


      arun


      hi,,
      You can try this out..

      select empid from emp where empid not in(4);



      this will give you ur desired result.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Code:
         select * from emp where  empid  in (select empid from emp group by empid having count(empid) =1)

        please consider the table is EMP


        hope it works fine for you.

        Comment

        • chandu031
          Recognized Expert New Member
          • Mar 2007
          • 77

          #5
          Hi,

          A slight change in the above query.

          select * from emp where empid in (select empid from emp group by empid having count(empid) >1)

          This will give you the set of duplicate records.

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            Please don't post duplicate threads. See the FAQ on the reasons for this. I have merged these threads together.

            ADMIN

            Comment

            Working...