Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    3

    Unhappy Unanswered: Need count and subselects

    Hello,
    i use mysql 4.0.20 and have the following problem:
    I have a column with names and want to extract all names which are lets say 3 times in this column. See

    Names
    foo
    bar
    bla
    foo
    bla
    bla
    foo

    In this case mysql shoud output foo and bla, but how to do this??
    I tried some combinations of count and something like subselects, but no success.

    Could anybody help me please? It drives me crazy.
    Thanks, b52

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    hmm, does mysql support having?

    group by names
    having count(*) = 3

  3. #3
    Join Date
    Jul 2004
    Posts
    3
    yea it does,
    i will give it a try, but not sure to get it working.

    Thanks, bye, b52

  4. #4
    Join Date
    Jul 2004
    Posts
    3
    YES it works!
    SELECT KNAME FROM AUFTRAG LEFT JOIN KUNDE ON KNR=AKNR GROUP by KNAME HAVING COUNT(*) =3


    Thank you , bye, b52

Posting Permissions

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