Created
November 4, 2012 20:10
-
-
Save reyjrar/4013466 to your computer and use it in GitHub Desktop.
PostgreSQL Windowing Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
srv.id, | |
srv.ip, | |
r.opcode, | |
r.status, | |
count(1) as queries, | |
sum(count(1)) OVER (PARTITION BY r.server_id) as total | |
from packet_response r | |
inner join server srv on r.server_id = srv.id | |
group by srv.id, r.server_id, r.opcode, r.status | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment