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 |
|
dinzg
Starting Member
6 Posts |
Posted - 2005-02-15 : 03:12:25
|
| When I use AVG function in query I get result like this:24,833333Is there any way to get result like: 24 without 833333? |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-02-15 : 03:25:03
|
Is the comma a typo - should it be 24.833333SELECT CONVERT(int,AVG(24.833333))AndyBeauty is in the eyes of the beerholder |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2005-02-15 : 03:46:49
|
| You can also use SELECT FLOOR(24.833333)or if you want to round you can use SELECT ROUND(24.833333, 0) which would give 25.000000or if you want to always round up you can use SELECT CEILING(24.833333) which would give 25see BOL for more details, especially if the average can be negative and you're using FLOOR or CEILINGsteveAnd how is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain. |
 |
|
|
dinzg
Starting Member
6 Posts |
Posted - 2005-02-15 : 06:03:01
|
| I used this one SELECT ROUND(24.833333, 0)thanks |
 |
|
|
|
|
|