From d650b70ba3fde0a0fad977cf4be5a64e18536e75 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 7 May 2010 15:45:47 +0100 Subject: [PATCH] Fixed SQL error --- app.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index 7659342..f2f57ff 100644 --- a/app.rb +++ b/app.rb @@ -34,10 +34,15 @@ get '/' do WHERE p.id = c.party_id - GROUP BY p.id + GROUP BY p.name ORDER BY votes desc ;") + +select p.name, count(c.*) AS seats +FROM parties p, councilcandidates c +GROUP BY p.id + @total_votes = Councilcandidate.sum(:votes_2010)