I'm using SQLite and have two tables:
Line { Element_ID, length }
Element{ Element_ID, Name }
I want to update the parameter "length" to a certain value in Line by specifying the "Name" in Element where Element_ID is the same for Line and Element.
SQLite does not support the JOIN statement in combination with the UPDATE statement, so I've been trying various combinations of UPDATE with EXISTS without any success. Example; update length to 2 for the line with element Name 'c18':
UPDATE Line
SET length = 2
WHERE EXISTS (SELECT length FROM Line WHERE Line.Element_ID = Element.Element_ID AND Element.Name = 'c18')
Result: Error: No such column: Element.Element_ID
UPDATE Line
SET length = 2
WHERE EXISTS (SELECT length FROM Line INNER JOIN Element ON Line.Element_ID = Element.Element_ID WHERE Element.Name = 'c18')
Result: The code updates length for ALL lines (it looks like it disregards the last part in the EXISTS-statement WHERE Element.Name = 'c18'. I don't understand why this is happening, because if I only run the SELECT-statement inside the WHERE EXISTS(..) the program selects the correct line (c18).
Can anyone help me with this?