author | František Kučera <franta-hg@frantovo.cz> |
Tue Apr 27 17:13:23 2010 +0200 (2010-04-27) | |
changeset 108 | f74a9fc683da |
child 109 | 374ec52b5b69 |
permissions | -rw-r--r-- |
franta-hg@108 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
franta-hg@108 | 2 |
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> |
franta-hg@108 | 3 |
<properties> |
franta-hg@108 | 4 |
<entry key="HLASOVANI_INSERT"> |
franta-hg@108 | 5 |
INSERT INTO hlasovani |
franta-hg@108 | 6 |
(podnik, hlas, ip_adresa) |
franta-hg@108 | 7 |
VALUES (:podnik, :hlas, :ip_adresa); |
franta-hg@108 | 8 |
</entry> |
franta-hg@108 | 9 |
<entry key="HLASOVANI_SELECT"> |
franta-hg@108 | 10 |
<!-- |
franta-hg@108 | 11 |
Poznámka k přetypování int4(count(*)): |
franta-hg@108 | 12 |
maximum je: 2 147 483 647 (tolik hlasů snad mít nikdy nebudeme :-) |
franta-hg@108 | 13 |
--> |
franta-hg@108 | 14 |
SELECT hlas, |
franta-hg@108 | 15 |
int4(count(*)) |
franta-hg@108 | 16 |
FROM ( |
franta-hg@108 | 17 |
SELECT DISTINCT ON (ip_adresa) |
franta-hg@108 | 18 |
hlas |
franta-hg@108 | 19 |
FROM hlasovani |
franta-hg@108 | 20 |
WHERE podnik = :podnik |
franta-hg@108 | 21 |
ORDER BY ip_adresa, id DESC |
franta-hg@108 | 22 |
) AS hlasy |
franta-hg@108 | 23 |
GROUP BY hlas; |
franta-hg@108 | 24 |
</entry> |
franta-hg@108 | 25 |
</properties> |