Reputation: 115
I have a table like the dummy table described below
I need to write a query to create a table such that I get the 95 percentile of the Count grouped by both Date and Server.
I dont have much experience with Sql, and after looking at the google search results, surfing through countless links I am a bit terrified after seeing a lot of subqueries used.No one is able to give a simple query. Can't we directly use a direct query to get the result like the following?
Can some one please provide the exact query which can be used?
Thanks for the help!!
Upvotes: 1
Views: 622
Reputation: 425391
SELECT *
FROM (
SELECT *, NTILE(20) OVER (PARTITION BY [date], [server] ORDER BY [count]) AS t
FROM mytable
) q
WHERE t < 20
Upvotes: 1