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 |
sqlnewbie77
Starting Member
2 Posts |
Posted - 2011-05-28 : 13:36:28
|
Need to write a SQL query that finds the most popular season from example table:ID | RespondentName | FavoriteSeason1 | John | Summer2 | Jane | Summer3 | Mark | Fall4 | Paul | Winter5 | Jeff | SpringNeeds to calculate the "favorite" and return JUST the name of the season |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-28 : 13:53:51
|
select top 1 FavouriteSeason, count(*)from tblgroup by FavouriteSeasonorder by count(*) desc==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
sqlnewbie77
Starting Member
2 Posts |
Posted - 2011-05-28 : 14:03:04
|
Thanks!! worked great!! |
|
|
|
|
|