mysql - Convert SQL query to Rails ActiveRecord query -
i have sql query multiple left joins works fine: query = <<-eos select date(t.completed_at) completed_date, s.id district, assignee_id, u.first_name, u.last_name, count(t.id) completed_tasks tasks t left join tickets k on k.id = t.ticket_id left join installations on i.id = k.installation_id left join administrative_areas on i.ward_id = a.id left join service_areas s on s.id = a.service_district_id left join users u on u.id = t.assignee_id 1 = 1 , s.id = '#{district_id}' , t.status = '#{status}' , t.kind = 1 , t.completed_at >= '#{days_ago.days.ago.beginning_of_day.to_s(:db)}' , t.completed_at <= '#{days_until.days.ago.beginning_of_day.to_s(:db)}' group date(t.completed_at), s.id, s.name, u.first_name, u.last_name, t.assignee_id eos i got value after mapping: [{:completed_date=>"2015-07-11", :district=>"1339", :assignee...