skip to Main Content

i tried to use subquery to show JOB_TITLE in the result this code work , but i can’t add JOB_TITLE ‘Jr. Designer’ in the result

select EMP_ID,F_NAME,L_NAME
from employees
where job_id in (select job_ident from jobs where JOB_TITLE= 'Jr. Designer'); 

2

Answers


  1. First run this by itself

    select job_ident from jobs where JOB_TITLE= 'Jr. Designer'
    

    do you get any rows back? if not, then the text does not match and you should fix that.

    JOB_ID on the employees table seems like a bad normalization. I’m supposing that is where it is located or you would get some error that you would post here. I would suggest normalizing that correctly in either case.

    Login or Signup to reply.
  2. Instead ofr an IN clause use JOIN

    select EMP_ID,F_NAME,L_NAME,JOB_TITLE
    from employees e INNER JOIN jobs j ON j.job_ident = e.job_id
    where JOB_TITLE= 'Jr. Designer';
    
     
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search