R.rere
R.rere

Reputation: 1

How to show mysql results using two tables

I created two tables - 1 for jobs and 1 for applications. When a user applies for a job, the job id is inserted into applications table.

My question is: After a user has applied to a job, how can I show only jobs that he didn't apply to?

Upvotes: 0

Views: 57

Answers (2)

Anup Raj
Anup Raj

Reputation: 34

Try to make out with this... hope it helps.

select jobid 
from jobs
where jobid not in(select jobid from applications where userid/username=person)

Upvotes: 0

Abu Yousef
Abu Yousef

Reputation: 570

You should use a mysql query like this :

First: select unique job_id from application table, and store them into array.

Second : select all jobs except those in the previous array:

Select * from jobs where id not in ($array);

Upvotes: 1

Related Questions