-
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?
-
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
-
Forum Rules
|
|