Permalink
Browse files

for our crazy SQL, mysql wants table aliases for no apparent reason

  • Loading branch information...
jrochkind committed Aug 23, 2012
1 parent 9cf1be9 commit 0e0b0a1b2ab7c21740ec237db72a8b01eb1b2160
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/controllers/report_controller.rb
@@ -47,15 +47,15 @@ def fetch_stats
(case when option_a = choice then 1 else 0 end) as win,
(case when choice is NULL then 1 else 0 end) as tie,
(case when option_b = choice then 1 else 0 end) AS loss
- FROM selections
+ FROM selections as opt_as
UNION ALL
SELECT option_b AS engine,
(case when option_b = choice then 1 else 0 end) as win,
(case when choice is NULL then 1 else 0 end) as tie,
(case when option_a = choice then 1 else 0 end) AS loss
- FROM selections
+ FROM selections as opt_bs
)

0 comments on commit 0e0b0a1

Please sign in to comment.