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 |
|
netwerkassist
Starting Member
13 Posts |
Posted - 2012-01-05 : 22:03:38
|
| I have a query that I need help with to return me the percentages of job timings from two temp tablesSELECT A.Average-B.Average /A.Average *100 AS PERCENTAGE_IMPROVEMENT,A.noofexec as newExecutioncount,B.noofexec as oldexecutioncountFROM (SELECT PRCSNAME, avg(jobtime)AS Average, max(jobtime)AS Maximum, min(jobtime)AS Minimum ,COUNT(1) AS noofexec FROM #JobTimings_NEWSERV group by PRCSNAME ) AJOIN (SELECT PRCSNAME, avg(jobtime)AS Average, max(jobtime)AS Maximum, min(jobtime)AS Minimum,COUNT(1) AS noofexec FROM #JobTimings_OLDSERV group by PRCSNAME) B ON A.PRCSNAME=B.PRCSNAMEORDER BY 2But not return the correct percntages, they are way too high.Appreciate help |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-01-05 : 23:34:25
|
[code]SELECT (A.Average - B.Average) / A.Average * 100 AS PERCENTAGE_IMPROVEMENT, A.noofexec as newExecutioncount, B.noofexec as oldexecutioncount[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-06 : 14:19:42
|
| i hope Average is of type float else make it like(A.Average - B.Average) / A.Average * 100.0------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|