0
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 'WHERE Clients.ClientID = '26' AND DFFieldDefinition.label = 'Geboortedatum' SET' at line 12

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

Kind regards!!

DanielBarbarian
  • 5,093
  • 12
  • 35
  • 44
  • I do not see any sense in your query by the way. – rbr94 Oct 28 '16 at 13:18
  • 1
    The most important part is missing from the error message: the place where your syntax goes wrong (after the `near` keyword). – András Oct 28 '16 at 13:21
  • 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 'WHERE Clients.ClientID = '26' AND DFFieldDefinition.label = 'Geboortedatum' SET' at line 12 – Hidde Koning Oct 28 '16 at 13:22
  • I want to update a specific field in this table, but can only reach this via all those nested tables.. But correct me if I'm wrong! :-) – Hidde Koning Oct 28 '16 at 13:24
  • I think the `FROM` keyword is the problem. Check out [this](http://stackoverflow.com/a/15209489/1531853) answer to find the exact format of an update query. – András Oct 28 '16 at 13:27

1 Answers1

0

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';
Faizan Younus
  • 793
  • 1
  • 8
  • 13