I have two tables that are in the same database. I can't seem to put a condition where it connects them somehow.
- So here I have two tables: table1 and table2.
- I also have columns under table1: card0, nameid
I also have columns under table2: equip_locations, id
nameid of table1 is the same as id of table2. That's why I'm trying to link them both in the query.
I want the query to find all entries in table1 that has equip_location set to 1024 in table2 then change the card0 to 0 in table1. I'm having a hard time explaining it. Anyway I tried the one below but I'm getting syntax error.
UPDATE gc.* SET `card0` = 0
FROM table1 AS gc
LEFT JOIN
table2 AS g
ON g.id = gc.nameid
WHERE g.equip_locations = 1024