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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql query

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-06-16 : 03:37:23
I want equal result query For MSSQL. I have attached Oracle Query .



SELECT TRUNC(AVG(EAC.WEIGHTAGE),2) AS WEIGHTAGE FROM EMRAssmtTitleChoiceData EAC

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-16 : 03:51:07
Can you give example data and wanted output?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-06-16 : 04:36:02
SELECT TRUNC(AVG(EAC.WEIGHTAGE),2) AS WEIGHTAGE FROM EMRAssmtTitleChoiceData EAC ;------VALUE IS 4.66


SELECT EAC.WEIGHTAGE FROM EMRAssmtTitleChoiceData EAC ;----TABLE VALUES ARE 3,7.4
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-16 : 04:49:22
Values 3, 7.4 would result in 5.20 and not 4.66


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-06-16 : 04:50:18
ok is there a query in sql server doing so?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-16 : 05:03:49
Try this - I think it will work:
convert(decimal(12,2),round(avg(EAC.WEIGHTAGE),2,1)) AS WEIGHTAGE


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-06-16 : 06:55:27
THANKS
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-16 : 07:26:01
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -