From ed04b3ce65364e71475679ddcced70fbdae466e3 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Thu, 10 Jun 2010 12:27:05 +0100 Subject: [PATCH] Fixed SQL query incompatibility between sqlite and postgres --- app.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.rb b/app.rb index 1b2f9a9..1286244 100644 --- a/app.rb +++ b/app.rb @@ -76,11 +76,11 @@ get '/services/:slug' do @min = @service.payments.min(:amount) @results = repository(:default).adapter.query(" - SELECT s.id, s.name AS supplier_name, s.slug AS supplier_slug, SUM(p.amount) AS total + SELECT s.name AS supplier_name, s.slug AS supplier_slug, SUM(p.amount) AS total FROM payments p, suppliers s WHERE p.supplier_id = s.id AND p.service_id = #{@service.id} - GROUP BY s.id + GROUP BY s.name, s.slug ORDER BY total DESC") haml :service