sugarcrm: mysql query update contacts

Query 1

Adds Vendedor = 1 To All Contacts that are Joined to a Manufacturer

 

 

UPDATE
contacts
INNER JOIN a26_proveedor_contacts_c ON contacts.id = a26_proveedor_contacts_c.a26_proveedor_contactscontacts_idb
INNER JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c

SET contacts_cstm.vendedor_c = 1

 

Query 2

Adds Cerrado = 1 To All Contacts that are Joined to a Lead that's Closed.

 

UPDATE
contacts
INNER JOIN leads_contacts_c ON contacts.id = leads_contacts_c.leads_contactscontacts_idb
INNER JOIN leads ON leads_contactsleads_ida = leads.id
INNER JOIN contacts_cstm 0N contacts.id = contacts_cstm.id_c

SET contacts_cstm.cerrado_c = 1

WHERE
leads.status = 'Cerrado'

Leave a Reply

Your email address will not be published. Required fields are marked *