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 |
|
Twolak
Starting Member
2 Posts |
Posted - 2005-05-05 : 12:53:50
|
| I have a table parts with few columns among which color, style, manufacturer, version, form a key. What I want to do is to select style that occours in the table most frequentlySelect style from parts where max(occurance of style)Having problems coming up with the right sql for that. Any ideas?Thanks |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2005-05-05 : 14:00:33
|
| select style,count(style) from table group by style order by count(style) ascMike"oh, that monkey is going to pay" |
 |
|
|
Twolak
Starting Member
2 Posts |
Posted - 2005-05-05 : 14:59:17
|
| Thanks, That will do. Cannot believe how simple it is and that I didn't think of it :). CheersTomasz |
 |
|
|
|
|
|