How to write this raw SQL query in Active Record Query Interface Report spam W.M. asked September 25, 2017 6:44pm in Rails W.M. September 25, 2017 6:44pm Report Here's the SQL: select s.name, p.name, count(i.id) as count from items i left join products p on p.id = i.product_id left join stores s on s.id = i.store_id group by p.id, s.id Thank you. Reply Join the discussion Create an account Log in