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 |
|
jhon11
Starting Member
42 Posts |
Posted - 2007-11-15 : 12:17:31
|
| Hi ,I have following results..its like this.Name Dose PhyId patienid -------------------------------------------------- Alprazolam .125 0037087 093007210901 Alprazolam .125 0037087 122001073601 Alprazolam .125 0037087 073007498901 Butabarbital .12 0037087 202079304601 Butabarbital .12 0037087 027001185501Now I want to add one more colum with this column.One should be give me o/p like AVERAGE PHY DOSE =( .125+.125+.125/3)where 3= total record for each item.Results should be like AS FOLLOW.Name Dose AVG PhyId patienid -------------------------------------------------- Alprazolam .125 .125 0037087 093007210901 Alprazolam .125 0037087 122001073601 Alprazolam .125 0037087 073007498901 Butabarbital .12 .12 0037087 202079304601 Butabarbital .12 0037087 027001185501Looking forward to your quick reply. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-15 : 12:23:16
|
| Posting your existing query would help us help you.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
jhon11
Starting Member
42 Posts |
Posted - 2007-11-15 : 12:39:55
|
| dude..I couldn't find my answer on that link.Could you please help me out that wht can i do?/..wht fuction i can use and how? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-15 : 12:48:40
|
| I didn't provide an answer. You haven't given us your query yet.But there is an AVG function in T-SQL.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
|
|
|
|
|