i have 5 tables
employees
ej_rels (employee job relationship table)
jobs
cj_rels (client job relationship table)
clients
im quit new to mysql and php
im trying to get an sql statment to select all jobs that the current loged in employee is NOT working on
SELECT jobs., ej_rels., employees.first_name FROM jobs LEFT JOIN ej_rels ON jobs.id=ej_rels.jobs_ref LEFT JOIN employees ON employees.id=ej_rels.employees_ref WHERE employees.id!= $employee_id;
this is what i got so far but it doesnt work because the result returns jobs that other employees are working on wihich is ok BUT what if the employee is working on a job with soem one else. that result is returned. If i do an sql to join all the tables i will get a shared job as to rows. which is correct. im thinking i can do an OR in my WHERE to say "dont select any with the id of this employee OR any one who is working with them on a job.
been stupmed here for a bit. any hints help criticism or suggestions welcome
thanks