Results 1 to 3 of 3

Thread: SQL NonDINSTINCT Records?

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    SQL NonDINSTINCT Records?

    I know it's possible to get unique records with DISTINCT, but what about the exact opposite? Is there a way to get only records that appear more than once?

    If so, can it be done with two fields? Like a non-distinct name and age? Or something like that?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I would imagine that would involve some sort of group by statement where the count of the groups is > 1.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    example (I tried this on MS SQL Server 7):


    PHP Code:
     SELECT CELLNUMBERINSTR_TYPECOUNT(CELLNUMBER), COUNT(INSTR_TYPE)
    FROM [Cell Equipment Complete]
    GROUP BY CELLNUMBERINSTR_TYPE
    HAVING COUNT
    (CELLNUMBER) > AND COUNT(INSTR_TYPE) > 
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

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



Click Here to Expand Forum to Full Width