Last active
November 22, 2018 15:07
-
-
Save ishideo/30c2ad999bfa0e37d7c7afcd400e3a5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select distinct | |
u.id | |
, u.last_name | |
, u.first_name | |
, u.last_name_kana | |
, case when d.user_id is null | |
then 2 | |
when d.user_id is not null | |
then 1 | |
end | |
from employees as e | |
left join users u | |
on e.user_id = u.id | |
left outer join deliverers as d | |
on e.user_id = d.user_id | |
and e.employee_id = d.employee_id | |
where e.employee_id = 10000001 | |
order by | |
u.last_name_kana asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment