MY TABLES:
USERS_1: USERS_2:
+------------+---------+ +------------+---------+
| id |username | | username |claimedBy|
+------------+---------+ +------------+---------+
| 4 | pitiqu | | myUsername | NULL |<- this should become 4
+------------+---------+ +------------+---------+
MY SQL: (Literally MySQL)
UPDATE UL
SET UL.claimedBy = US.username
FROM USERS_1 as UL
INNER JOIN USERS_2 as US
ON US.id = 4
where UL.username="myUsername"
It's probably obvious that i want to set table 2's claimed_by (for the username "myUsername") to the username "pitiqu" found in table 1 at id = 4.
I'm sorry if all the "username" is confusing. Hope the tables and the SQL clears my question.
The error that pops out:
#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 'FROM USERS_1 as UL INNER JOIN USERS_2 as US ON US.id = 4 where UL' at line 3
Why is this happening... anyone?
EDIT : Excuse me for the incorrect syntax. I've been trying to use THIS example and while editing it I deleted the SET.