Hello everyone,
Sorry to keep asking questions but I need help with a select statement. I have the following select statement:
SELECT distinct(pers.pers_id),sta.per_status, add.per_address, job.job_category
FROM person pers, status sta, address add, jobs job
WHERE sta.per_status in ('Full', 'Part')
AND job.job_category in ('RECEPTIONIST', 'CLERK', 'CASHIER', 'AGENT')
AND job.status <> 'ACTIVE'
AND add.state = 'GEORGIA'
AND pers.pers_id = sta.pers_id
AND sta.pers_id = add.pers_id
AND add.pers_id = job.pers_id;
I would like the query to pull all employees that are 'Full-time' and 'Part-time' with job_categories being either receptionist, clerk, cashier, or agent and for ALL of those existing job categories to not be 'ACTIVE'. However, the query above is pulling data back even if one of the job_categories is not 'ACTIVE'. For example, if person 123 belongs in both the RECEPTIONIST and CLERK categories and the CLERK category is not 'ACTIVE' but the RECEPTIONIST category is 'ACTIVE', it still pulls the record for CLERK. I would like it to pull data only if RECEPTIONIST and CLERK are BOTH not 'ACTIVE'
I hope I didn't confuse anyone. I appreciate any help I can get on this.
Thanks again,
sql99
Sorry to keep asking questions but I need help with a select statement. I have the following select statement:
SELECT distinct(pers.pers_id),sta.per_status, add.per_address, job.job_category
FROM person pers, status sta, address add, jobs job
WHERE sta.per_status in ('Full', 'Part')
AND job.job_category in ('RECEPTIONIST', 'CLERK', 'CASHIER', 'AGENT')
AND job.status <> 'ACTIVE'
AND add.state = 'GEORGIA'
AND pers.pers_id = sta.pers_id
AND sta.pers_id = add.pers_id
AND add.pers_id = job.pers_id;
I would like the query to pull all employees that are 'Full-time' and 'Part-time' with job_categories being either receptionist, clerk, cashier, or agent and for ALL of those existing job categories to not be 'ACTIVE'. However, the query above is pulling data back even if one of the job_categories is not 'ACTIVE'. For example, if person 123 belongs in both the RECEPTIONIST and CLERK categories and the CLERK category is not 'ACTIVE' but the RECEPTIONIST category is 'ACTIVE', it still pulls the record for CLERK. I would like it to pull data only if RECEPTIONIST and CLERK are BOTH not 'ACTIVE'
I hope I didn't confuse anyone. I appreciate any help I can get on this.
Thanks again,
sql99