以下のクエリをルビで書くにはどうすればよいですか。
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