Skip to content

Instantly share code, notes, and snippets.

@mdauphin
Created August 16, 2016 09:25
Show Gist options
  • Save mdauphin/c92567528e900be9b2c3a2a89dbb23eb to your computer and use it in GitHub Desktop.
Save mdauphin/c92567528e900be9b2c3a2a89dbb23eb to your computer and use it in GitHub Desktop.
Retrieve all emails for sugarcrm users
-- Retrieve all emails for sugarcrm users
SELECT user_name, email_addresses.email_address
FROM `users`
JOIN email_addr_bean_rel on bean_id = users.id
JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id
WHERE status = 'Active' and user_hash is not null and users.deleted = 0 and email_addresses.invalid_email = 0
order by user_name ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment