tags:

views:

110

answers:

2

I'm attempting to create percentile scores. My query generates the ranks correctly, but the divide does nothing(the ranks are displayed in the columns rather than scores)

"/"(RANK() OVER(ORDER BY "Disk IO"),Count(*)) "Disk IO Score"

I've also tried generating the rank then selecting that and dividing, but it has the same result.

SELECT ..."/"("Disk IO Score",Count(*)) "Score"...
FROM(....RANK() OVER(ORDER BY "Disk IO") "Disk IO Score"...)

Thanks, Buzkie

SELECT "System_Name", "/"(RANK() OVER(ORDER BY "Disk IO"),Count(*)) "Disk IO Score" 
FROM (Select...)
GROUP BY "System_Name", "Disk IO"
A: 

Seems you are using aggregate COUNT(*) rather than analytic one.

Try this:

SELECT  RANK() OVER (...) / COUNT(*) OVER (...)

And could you please post the whole query (including GROUP BY clauses)?

Quassnoi
code updated above
Buzkie
I think I've figured out the problem. The counts are returning the number of instances of each server which is 1 due to the grouping. Can you think of a way that I could get the count of all the servers?
Buzkie
It's hard to tell with all your obfuscations. What is the server?
Quassnoi
A: 

I guess it's answered. The count(*) was returning 1 so I was just dividing by 1.

Buzkie