diff -r 000000000000 -r f74a9fc683da java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/PodnikDAO.sql.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/dao/PodnikDAO.sql.xml Tue Apr 27 17:13:23 2010 +0200 @@ -0,0 +1,25 @@ + + + + + INSERT INTO hlasovani + (podnik, hlas, ip_adresa) + VALUES (:podnik, :hlas, :ip_adresa); + + + + SELECT hlas, + int4(count(*)) + FROM ( + SELECT DISTINCT ON (ip_adresa) + hlas + FROM hlasovani + WHERE podnik = :podnik + ORDER BY ip_adresa, id DESC + ) AS hlasy + GROUP BY hlas; + + \ No newline at end of file