Hey all,
I need to query my database table to find which employee has the most support tickets related to them. I can do this just fine using this MySQL query:
SELECT employee_id, COUNT(id) AS number_of_tickets FROM tickets GROUP BY employee_id ORDER BY number_of_tickets DESC LIMIT 1;
How would write this in Ruby-on-Rails?
Thanks very much for your assistance.
I use Ruby version 1.8.6, Rails version 2.2.2 and MySQL Server version 5.0.