Reputation: 1668
In my query i have to check three conditions and join and where is common..but some errors in this
select
count(case when interview_status = 1 then applicant_id else null end) as selected,
count(case when interview_status = 2 then applicant_id else null end) as rejected,
count(case when interview_status = 3 then applicant_id else null end) as not_attented,
JOIN appointment ON appointment.applicant_id=student_application.applicant_id,
WHERE filter_status=1 AND appointment_status !=0
from student_application;
But this shows some errors
Upvotes: 0
Views: 36
Reputation: 8093
,
.from
clause should be before where
select
count(case when interview_status = 1 then applicant_id else null end) as selected,
count(case when filter_status = 2 then applicant_id else null end) as rejected,
COUNT(CASE WHEN FILTER_STATUS = 2 THEN APPLICANT_ID ELSE NULL END) AS NOT_ATTENTED
from student_application
JOIN appointment ON appointment.applicant_id=student_application.applicant_id
WHERE FILTER_STATUS=1 AND APPOINTMENT_STATUS !=0;
Upvotes: 2