I have two unrelated tables which I want to get info from for one query, each needs to be joined against another table...
I'm doing this in postgres, but I'm imagining it's a standard SQL question so I'm posting here... essentially, I want
And no, there's no table where customer_id is listed to start from and join against as it's a FK to an entirely separate database. I have a feeling this is easy and I'm brainfarting, but I'd really appreciate a leg up on this one. Thanks.
I'm doing this in postgres, but I'm imagining it's a standard SQL question so I'm posting here... essentially, I want
Code:
SELECT email.email, url.url
FROM email, url
JOIN account_has_email ON contactemail.email_id = email.email_id
JOIN account_has_url ON account_has_url.url_id = url.url_id
WHERE contactemail.customer_id=5 AND account_has_url.customer_id=5
And no, there's no table where customer_id is listed to start from and join against as it's a FK to an entirely separate database. I have a feeling this is easy and I'm brainfarting, but I'd really appreciate a leg up on this one. Thanks.