Task:
Criteria: Candidates which became active
Query:
select vacancies.id, vacancies.name, count(DISTINCT applications.candidates_id) as count
from applications
left join vacancies on applications.vacancies_id = vacancies.id
inner join comments
on commentable_type = 'backend\models\Candidates'
and commentable_id = applications.candidates_id
where vacancies.consultants_id in (157, 171, 165, 79, 179)
and text ilike '%to Active'
group by vacancies.id, vacancies.name
order by count desc
limit 25;
Leave a Reply
You must be logged in to post a comment.