Results 1 to 2 of 2

Thread: Check max appearance

  1. #1
    Join Date
    Jan 2003
    Posts
    30

    Check max appearance

    Iz it possible that i can find out which model name has appeared the most number of times in my database? Lets say under the field MODEL, there can be many different names for the model. How can i check which name appeared the max no. of times?


  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    If you are using SQL 2000

    select Top 1 Title, count(*)
    from Employees
    group by Title
    order by count(*) desc

    For others

    select Title, count(*)
    from Employees
    group by Title
    having count(*) = (select max(a.counter)
    from
    (select count(*) as counter
    from Employees
    group by Title) a)

Posting Permissions

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