Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created November 20, 2012 13:09
Show Gist options
  • Select an option

  • Save ychaouche/4117861 to your computer and use it in GitHub Desktop.

Select an option

Save ychaouche/4117861 to your computer and use it in GitHub Desktop.
transform a where to a join
SELECT contacts.first_name, contacts.last_name, email_addresses.email_address
FROM
contacts
INNER JOIN email_addr_bean_rel
ON contacts.id = email_addr_bean_rel.bean_id
INNER JOIN email_addresses
ON email_addresses.id = email_addr_bean_rel.email_address_id
WHERE email_addresses.email_address = '[email protected]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment