Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
swansystem
Starting Member
2 Posts |
Posted - 2011-01-13 : 10:05:36
|
I need found the most frequent value in a field. Who help me? |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-01-13 : 10:12:21
|
[code]select field, count(*)from tablegroup by field[/code] |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-01-13 : 10:13:08
|
[code]SELECT TOP 1 fieldName FROM yourTable GROUP BY fieldName ORDER BY COUNT(fieldName) DESC;[/code] |
 |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-01-13 : 10:14:55
|
Damn, I forgot the order by.. |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-01-13 : 10:18:25
|
I think you probably got the OP close enough |
 |
|
|
|
|