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 |
yuri1992
Starting Member
2 Posts |
Posted - 2009-04-26 : 09:20:26
|
hello to all , i have problem , my sql table called Kingsand its look like this ID Game1 Game2 Game3 Game4 Game5 Game6 Game 7 Date Username1 213 222 323 232 522 212 122 3.4.09 user12 214 212 325 432 262 222 292 3.4.09 user553 253 222 523 832 224 232 228 3.4.09 user774 273 212 723 233 222 225 272 3.4.09 user55 223 272 363 123 122 262 622 3.4.09 user2I need to pull from the table ten numbers that appeared most in columns game1 game2 game3 game4 game5 game6 game7 and show them in Sort order how i do this ? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-26 : 09:22:39
|
What is your expected output from above posted sample data? E 12°55'05.63"N 56°04'39.26" |
|
|
yuri1992
Starting Member
2 Posts |
Posted - 2009-04-26 : 09:55:42
|
the output will be 1)222 - show 4 time2)212 - show 2 timeand Onwards |
|
|
singularity
Posting Yak Master
153 Posts |
Posted - 2009-04-26 : 12:53:28
|
select top 10 gamefrom(select game, count(*) as cntfrom(select game1 as gamefrom kingsunion allselect game2 as gamefrom kingsunion allselect game3 as gamefrom kingsunion allselect game4 as gamefrom kingsunion allselect game5 as gamefrom kingsunion allselect game6 as gamefrom kingsunion allselect game7 as gamefrom kings) agroup by game) border by cnt desc |
|
|
|
|
|