Hi,
I need to get all Contacts from the Mysql DB WITH email and Account.name
How do I have to join the tables?
select first_name,last_name,title,department,phone_mobile,phone_work,phone_fax,birthday,primary_address_street,primary_address;
but mail adress and account.name have to be joined…
any suggestions?
Thanks, Sebastian
PS: i found https://pypi.org/project/sugarcrm/ but am not sure if this works with suitecrm. And api is much slower then getting things via SQL-Query…
Here it is.
SELECT contacts.id,contacts.first_name,accounts.name,email_addresses.email_address FROM contacts
INNER JOIN accounts_contacts ON accounts_contacts.contact_id = contacts.id AND accounts_contacts.deleted=0
INNER JOIN accounts ON accounts.id = accounts_contacts.account_id AND accounts.deleted=0
LEFT JOIN email_addr_bean_rel eabr ON eabr.bean_id = contacts.id AND eabr.deleted=0 AND eabr.bean_module='Contacts'
LEFT JOIN email_addresses ON email_addresses.id = eabr.email_address_id AND email_addresses.deleted=0
2 Likes
thanks for the quick answer!!!