I have the following statement, where I get user-data, user-addresses and additional user-address-attributes in one query. This works perfectly unless there are no address-attributes for the addresses, this means in "s_user_addresses_attributes" are no hits. How can I achieve that this fact is ignored? In such cases it would be enough to just get user-data and user-addresses.
SELECT *
FROM s_user AS a
JOIN s_user_addresses AS b
JOIN s_user_addresses_attributes AS c
WHERE a.id = 416
AND b.user_id = a.id
AND b.id = c.address_id
AND b.id != IF (((SELECT COUNT(*) FROM s_user_addresses WHERE user_id = a.id) > 1), a.default_billing_address_id, 0)
ORDER BY a.id