Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT IFNULL(customer_id,customer_id2), name, phone_num FROM(
- SELECT c.customer_id, name, p.customer_id AS customer_id2, phone_num
- FROM customers c
- LEFT JOIN phone_numbers p
- ON c.customer_id = p.customer_id
- UNION (
- SELECT *
- FROM customers c
- RIGHT JOIN phone_numbers p
- ON c.customer_id = p.customer_id)
- ) a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement