Results 1 to 5 of 5

Thread: Compare?

  1. #1
    Join Date
    Jul 2004
    Posts
    191

    Unanswered: Compare?

    How can I compare data in 1 column??

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    What does that mean?

    SELECT *
    FROM myTable99 a
    INNER JOIN myTable99 b
    ON a.Key = b.Key
    WHERE a.Col <> b.Col

    ??????????????????????????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jul 2004
    Posts
    191
    It means that I need to see what names are being duplicated in 1 column.

    Thanks

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Code:
    USE Northwind
    GO
    
    SET NOCOUNT ON
    CREATE TABLE myTable99(Col1 varchar(25))
    GO
    
    INSERT INTO myTable99(Col1)
    SELECT 'Apples' UNION ALL
    SELECT 'Apples' UNION ALL
    SELECT 'Bananas' UNION ALL
    SELECT 'Cherries' UNION ALL
    SELECT 'Dates' UNION ALL
    SELECT 'Eldiberries' UNION ALL
    SELECT 'Figs' UNION ALL
    SELECT 'Figs' UNION ALL
    SELECT 'Guave'
    GO
    
      SELECT Col1, COUNT(*) 
        FROM myTable99 
    GROUP BY Col1 
      HAVING COUNT(*) > 1
    GO
    
    SET NOCOUNT OFF
    DROP TABLE myTable99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jul 2004
    Posts
    191
    Thanks, very much.

    Lystra

Posting Permissions

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