Skip to content
Advertisement

Updating multiple tables in SQL using an Array

Currently I had a table called crm_leads for my Leads page where I already have many records. Now for the same page I have created few new fields which is now going to be stored in another table called crm_leads_details. Now I’m storing all my POST values in an array format like so:

JavaScript

Now in my model I’m trying to use this statement to update both my tables but it does not work:

JavaScript

This gives the following output UPDATE crm_leads LEFT JOIN crm_leads_details ON crm_leads.id=crm_leads_details.leads_id SET Array WHERE Array

Additionally, since crm_leads_details is a new table there are currently no records in it so not sure if LEFT JOIN crm_leads_details ON crm_leads.id=crm_leads_details.leads_id will work here

Advertisement

Answer

Write the query like this

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement