2017-04-23 42 views
-1

我在我的db..one 2個表是hr_request_consultant ,另一種是hr_request_candidate,加入2個表,並顯示特定列的計

1)hr_request_consultant:

ID, hr_request_id, consultant_id。

2)hr_request_candidate: id, hr_request_id, candidate_id。

,所以我想加入這兩個表和hr_request_consultant表計算特定hr_request_id的候選人

誰能幫助我 在此先感謝

回答

0
select a.hr_request_id, count(b.candidate_id) 
from hr_request_consultant a 
inner join hr_request_candidate b 
on a.hr_request_id = b.hr_request_id 
group by a.hr_request_id 

我覺得應該做的工作?

+0

我得到錯誤查詢錯誤(1054):'字段列表'中的未知列'b.hr_request_candidate' – bharathi

+0

修改和修復。你真的沒有投票給我嗎?這是相當可憐的形式... – Henry

+0

不,我沒有downvoted ..我認爲有人這樣做 – bharathi