I’m trying to create a table which lists all the people with job titles that contain ‘Professor’ and their projects.
I can get a return with the ‘Professor and Chair’, plus ‘Associate Professor’, with the JOIN, and without the JOIN all three together (Professor and Chair, Professor, Associate Professor. But not all three with the JOIN.
I’m wondering if I need to reorder my code? I’m currently learning.
I’ve tried variations of Professor
, %Professor%
etc after AND and it still doesn’t work.
With this I get a return of all three
SELECT
sl.fullname AS 'FULL NAME',
sl.jobtitle AS 'JOB TITLE'
FROM staff_list AS sl
WHERE sl.jobtitle LIKE '%Professor%';
With this I only get Professor and Chair, and Associate Professor
SELECT
sl.fullname AS 'FULL NAME',
sl.jobtitle AS 'JOB TITLE',
p.project_name AS 'PROJECT NAME'
WHERE staff_list AS sl
RIGHT JOIN projects AS p
ON sl.staff_id = p.staff_lead
WHERE sl.jobtitle LIKE '%Professor%';
7