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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to get result in decimal using AVG Function

Author  Topic 

shahbazwasti
Starting Member

2 Posts

Posted - 2007-08-08 : 01:52:05
Hello Sir
I am working on a Teacher Evaluation Project. In my database I store results from 1-5 as evaluation indicators. I apply AVG() function on the result column. The result of the query is in integer values (i.e) 4, 3 2 or 5. I want the resutl up to two decimal places. How can i write the query to get the result in decimal form?

Shahbaz Hassan Wasti

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-08 : 02:09:50
[code]avg(result * 1.0)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2007-08-08 : 02:09:59
SELECT AVG(1.00 * ColumnName) FROM TableName
Go to Top of Page

shahbazwasti
Starting Member

2 Posts

Posted - 2007-08-09 : 05:10:11
Thanx

Shahbaz Hassan Wasti
Go to Top of Page
   

- Advertisement -