如何在 ruby 中编写以下查询。
select count(*), project_types.project_type_name,company_id from project_type_stages_questions,project_types where (project_type_stage_id in
(select project_type_stages_id from project_type_stages where project_type_id in (select project_type_id from project_types))) group by project_type_stage_id,project_types.project_type_name,company_id