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 |
|
yanaho
Starting Member
20 Posts |
Posted - 2010-02-04 : 12:27:30
|
| Hi, I need help with a query.2 Columns I am interested in is 'Office' and 'Score' from same tableI would like to get an average score per office in one query.For example:Office1AVG Office2 Office3 Office498% 80% 75% 90% |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-02-04 : 12:30:19
|
| select avg(score),office from yourtable group by officePBUH |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 12:33:19
|
| how will avg be a %? |
 |
|
|
yanaho
Starting Member
20 Posts |
Posted - 2010-02-04 : 12:57:09
|
| visakh16, sorry it is already a percent.Thanks Idera, I'm retarded. I pictured the end result differently, but your solution is correct. |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-02-04 : 13:01:14
|
quote: Originally posted by yanaho visakh16, sorry it is already a percent.Thanks Idera, I'm retarded. I pictured the end result differently, but your solution is correct.
Dont worry it happens sometimes, even simple solution seems tough enough.But as per ur intial requirement it seems that u need a pivot kind of resultset.PBUH |
 |
|
|
|
|
|