There are 3 tables:
1.users (id_user, name)
2.job_post (id_post,id_company,jobtitle)
3.apply_job_post(id_apply, id_post,id_user)
how to count particular job applied person - any one can help me
There are 3 tables:
1.users (id_user, name)
2.job_post (id_post,id_company,jobtitle)
3.apply_job_post(id_apply, id_post,id_user)
how to count particular job applied person - any one can help me
You need count and group them
select id_user,count(id_post) from users
left join apply_job_post on apply_job_post.id_user = users.id_user
left join job_post on apply_job_post.id_post = job_post.id_post
group by users.id_user
If you want to fetch the count of users get assigned a particular job then use the following query:
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
If you want to fetch how many jobs assigned to one particular user then you can use the following query:
The following example shows how many jobs assigned to 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
If you want to fetch whole data from three tables then:
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