Answer the question
In order to leave comments, you need to log in
How to margin after join?
after this script,
select o.email, u.email from apartments a
left join users u on u.id = a.publisher_id AND a.publisher_type=0
left join organizations o on o.id=a.publisher_id AND a.publisher_type=1
email | email
[email protected] | NULL
NULL | [email protected]
email
[email protected]
[email protected]
Answer the question
In order to leave comments, you need to log in
Another option:
select email from users where id in(
select distinct publisher_id from apartments where publisher_type=0
)
UNION
select email from organizations where id in(
select distinct publisher_id from apartments where publisher_type=1
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question