user1356163
user1356163

Reputation: 407

join two tables when one has null values

enter image description here

I want to list employees along with their jobs from job tables(use job_id key) but some employees have null as their job id and when i use join null values dont show up. i want the employees with no job ids to have null as their job designation. how do i do it?

Here is what i have tried

select EMP_ID,MANAGER_EMP_ID,FNAME||' '||LNAME as EMP_FULL_NAME,
HIRE_DATE as EMP_JOINING,salary as EMP_SALARY,function as
EMP_DESIGNATION from employee e join job j on e.job_id=j.job_id

Upvotes: 1

Views: 1761

Answers (1)

Raphaël Althaus
Raphaël Althaus

Reputation: 60493

just change join to left join...

Upvotes: 6

Related Questions