Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[volby] ukazka vypoctu tesnych senatnich voleb #104

Open
kokes opened this issue Jul 22, 2020 · 0 comments
Open

[volby] ukazka vypoctu tesnych senatnich voleb #104

kokes opened this issue Jul 22, 2020 · 0 comments

Comments

@kokes
Copy link
Owner

kokes commented Jul 22, 2020

with hlasy as (
	SELECT
		datum,
		obvod,
		jmeno || ' ' || prijmeni AS jmeno,
		hlasy_k2,
		rank() over(partition by datum, obvod order by hlasy_k2 desc) as poradi
	FROM
		volby.senat_kandidati
	WHERE hlasy_k2 > 0
), naskoky as (
	select
	*, hlasy_k2 - lag(hlasy_k2) over(partition by datum, obvod order by poradi desc) as naskok
	from hlasy
)

select * from naskoky where naskok is not null order by naskok asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant