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 |
|
kieran5405
Yak Posting Veteran
96 Posts |
Posted - 2009-04-03 : 12:00:24
|
| Hi,I thought this would be simple but now it looks like i am in fact the simple one!!!I have a table which has one column for employee nos. The employee nos can be repeated in this column.I am trying to find the largest number of repeats for a number in the column. For example, employee no 5 is repeated 50 times...and so is repeated the most.But I can not figure a way to do this.Thanks for any input... |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-04-03 : 12:07:00
|
| [code]select top 1 empid,count(empid)from yourtablegroup by empidorder by 2 desc[/code] |
 |
|
|
kieran5405
Yak Posting Veteran
96 Posts |
Posted - 2009-04-03 : 12:12:11
|
| cheers...worked perfectly.why cant i work this stuff out!!! |
 |
|
|
|
|
|