2015-10-17 47 views
0

在我的查询我要检查三个条件及加盟,其中common..but一些错误在这加入与案件查询

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; 

但是这显示了一些错误

+0

#1064 - 你在你的SQL语法错误;检查与您的MySQL服务器版本相对应的手册,在第5行'JOIN约会ON约会.applicant_id = student_application.applicant_id'附近使用正确的语法。 – robins

+0

显示此错误 – robins

+0

如果我的答案适合您,请接受它,以便该问题可以被关闭。 – Utsav

回答

2
  1. 我看到了问题额外,
  2. from条款应前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; 
    
+0

我可以问有关这个答案 – robins

+0

当然。但如果这是一个新问题,你最好把它作为一个新的问题,以便其他人也可以提出另一个答案。 – Utsav