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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-30 : 00:02:46
|
| uzma writes "hi i want to find out three-day average and match some columns of a single row.What i want is, i have 7 columns giving 7 different traffic values. I want to get 3 maximum values from those 7, and divide them by 3 , to get the average. I require this information so i can get out precisely how much traffic load is present at a site. I tried working with Max but the query is not giving me 3 maximum values.i have been searching over the net for this specific problem but have not been able to find a proper result.I need help ASAP.Thanks anyway" |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-11-30 : 00:59:34
|
| select avg(t.col1) from (select top 3 col1 as val from mytable order by col1 desc) as t-----------------[KH] |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-30 : 07:25:55
|
| well. i guess it would be great if you can post some input resutlt.. and expected result...????or try out the Case When .. ??? and compare the 7 cols.. ????Sucess Comes to those who Believe in Beauty of their Dream.. |
 |
|
|
|
|
|