共有3张桌子:
1.users (id_user, name)
2.job_post (id_post,id_company,jobtitle)
3.apply_job_post(id_apply, id_post,id_user)
如何计算特定的求职者-任何人都可以帮助我
答案 0 :(得分:-1)
如果要获取用户数,则分配特定的工作 然后使用以下查询:
SELECT
count(u.id_user)
FROM apply_job_post AJP
LEFT JOIN job_post JP ON JP.id_post=AJP.id_post
LEFT JOIN users U ON AJP.id_user=U.id_user
where JP.id_post=2
如果要获取分配给一个特定用户的作业数,则可以使用以下查询:
以下示例显示了分配给id_user=1
SELECT
count(u.id_user)
FROM apply_job_post AJP
LEFT JOIN job_post JP ON JP.id_post=AJP.id_post
LEFT JOIN users U ON AJP.id_user=U.id_user
where u.id_user=1
如果要从三个表中获取全部数据,则:
SELECT
U.*,
JP.*,
AJP.*
FROM apply_job_post AJP
LEFT JOIN job_post JP ON JP.id_post=AJP.id_post
LEFT JOIN users U ON AJP.id_user=U.id_user