Hidde Koning Hidde Koning - 1 month ago 6
MySQL Question

MYSQL Update Query syntax error 28-10-2016a

UPDATE DFEntryValues
SET DFEntryValues.DFFieldvalue = NOW()
FROM DFEntryValues
JOIN DFEntries ON DFEntryValues.DFEntryID = DFEntries.DFEntryID
JOIN DynamicFormStructures ON DFEntries.DynamicFormStructureID = DynamicFormStructures.DynamicFormStructureID
JOIN Projects ON DynamicFormStructures.ProjectID = Projects.ProjectId
JOIN Clients ON Projects.ClientID = Clients.ClientID
JOIN DFFieldDefinition ON DFEntryValues.DFFieldDefinitionID = DFFieldDefinition.DFFieldDefinitionID
WHERE Clients.ClientID = '26' AND DFFieldDefinition.label = 'Geboortedatum';


I get the following error:

Error Code: 1064


You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near


Can someone point me out what's wrong with this query?

Kind regards!!

Answer

It seems you are not using correct format. Hope this helps.

UPDATE DFEntryValues JOIN DFEntries ON DFEntryValues.DFEntryID = DFEntries.DFEntryID
JOIN DynamicFormStructures ON DFEntries.DynamicFormStructureID = DynamicFormStructures.DynamicFormStructureID 
JOIN Projects ON DynamicFormStructures.ProjectID = Projects.ProjectId 
JOIN Clients ON Projects.ClientID = Clients.ClientID 
JOIN DFFieldDefinition ON DFEntryValues.DFFieldDefinitionID = DFFieldDefinition.DFFieldDefinitionID 
SET DFEntryValues.DFFieldvalue = NOW() 
WHERE Clients.ClientID = '26' AND DFFieldDefinition.label = 'Geboortedatum';