I have 2 tables. In one table I have id and in another I have userId. This is the only connection between them.
Problem is: In one table I have username and in another I have his balance. I want to get user's balance according to his username. Since there is only one column which is connecting them and it is ID, I need to find a way how to update users balance if I have only his username.
Here is what I have tried but it is not working:
UPDATE t1
SET t1.balance = '999'
FROM bitcoin.accountbalance AS t1
INNER JOIN bitcoin.webusers AS t2
ON t1.userId = t2.id
WHERE t2.username = 'simpanz';
EDIT:
ERROR IS: 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 'FROM bitcoin.accountbalance AS t1 INNER JOIN bitcoin.webusers AS t2 WHERE ' at line 3
I use MySQL.