Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778

    Unanswered: Select duplicate column values

    Hi,

    How do I select rows that contain the duplicate values for a giev column.

    Eg,

    C1 | C2
    a
    b
    a

    I need to select a.

    Cheers.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select C1, C2
    from yourtable
    where C1 in
    ( select C1 from yourtable
    group by C1
    having count(*) > 1 )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2011
    Posts
    2

    Select Single Duplicate Value + Select the other values

    Hi,

    I want to select only one duplicate value from the column + select other values.

    For ex:

    Column 1 Column 2 Column 3

    28/11/2011 Item 1 Received

    27/11/2011 Item 2 Received

    24/11/2011 Item 3 Pending

    28/11/2011 Item 4 Pending

    25/11/2011 Item 5 Pending



    I want to get output like this :


    24/11/2011

    25/11/2011

    27/11/2011

    28/11/2011 ----> This is single value from the duplicate values and also

    sorted.


    If any one know how to get this output, please reply.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    wow, an 8-year-old thread, answered within 10 minutes

    Quote Originally Posted by Sathya65 View Post
    If any one know how to get this output, please reply.
    Code:
    SELECT DISTINCT column1
      FROM daTable
    ORDER
        BY column1
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Nov 2011
    Posts
    2

    Thanks

    Thanks a lot. It work's. What is your name?

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i am the rudeboy, the rudester, the sqlmeister

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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