本文介绍了帮助进行联接查询和计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我进行查询
tbl-A
职位编号,雇主编号,职称,描述,技能,状态
tbl_b
申请编号,职位编号,候选人编号,申请状态
我希望结果如下所示
职位编号,雇主编号,职称,描述,技能,状态,申请人
申请者列是tbl_b组中Jobid的总数
在此先感谢
亲切的问候
Kindly help me with a query
tbl-A
jobid, employerid, jobtitle, description, skills, status
tbl_b
Applicationid, jobid, candidateid,Appliedon status
I want the result to be as below
Jobid, employerid, jobtitle, description, skills, status, Applicants
Applicants column would be total count from tbl_b group by jobid
Thanks in advance
kind regards
推荐答案
select b.jobid,count(b.jobid) as ApplicantsCount,a.* from
tbl_job a inner join tbl_applicants b
on a.jobid=b.jobid
where a.Employerid=@Employerid
group by a.jobid,b.jobid,a.EmployerId,a.CreatedUserId,a.jobtitle,a.categoryid,a.description,a.skills,a.contactperson,a.contactnumber,a.createddate,a.expiredon,a.status
这篇关于帮助进行联接查询和计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!