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 |
|
pureclass85
Starting Member
29 Posts |
Posted - 2009-03-11 : 13:52:41
|
| how do i count and display the highest number of duplicated data iecolaaaabbbccthen display a table like:entry | number of entriesa | 4 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-03-11 : 14:06:52
|
| select col, num = count(*)from tblgroup by colorder by count(*) descfor the top oneselect top 1 col, num = count(*)from tblgroup by colorder by count(*) desc==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
pureclass85
Starting Member
29 Posts |
Posted - 2009-03-11 : 14:17:37
|
| very odd dosnt seam to work |
 |
|
|
pureclass85
Starting Member
29 Posts |
Posted - 2009-03-11 : 14:33:35
|
| it works but i dont know how to only get the highest value and none of the rest 'top 1' dosent seam to work |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-03-11 : 15:03:32
|
| The top 1 query should work fine...whats the error you get when you run it? |
 |
|
|
pureclass85
Starting Member
29 Posts |
Posted - 2009-03-11 : 15:12:22
|
| 'You have an error in your sql syntax' error 1064 |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-03-11 : 15:13:29
|
| Can you post the exact query you tried? |
 |
|
|
pureclass85
Starting Member
29 Posts |
Posted - 2009-03-11 : 15:16:24
|
| just fixed it!! thanks |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-03-11 : 15:34:02
|
| Ok...great |
 |
|
|
|
|
|