Error when trying to SET field in MySQL

0

I am trying to set the field block, in the table h8cyw_users, to 1 where the email field in both tables are the same. I am using the following script:

UPDATE UPDATE table1 
SET block='1'
WHERE email IN (SELECT db2.table2.email 
                FROM db2.table2
                WHERE db2.table2.status_id='10');

I get the following error:

Failed to execute SQL : SQL UPDATE UPDATE table1 SET block='1' WHERE email IN (SELECT db2.table2.email FROM db2.table2 WHERE db2.table2.status_id='10'); failed : 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 'UPDATE table1 SET block='1' WHERE email IN (SELECT db2.table2' at line 1

Where am I going wrong?

Arthur Walker

Posted 2015-07-15T22:50:24.593

Reputation: 121

Answers

2

The word update is in there twice try this

UPDATE table1 
SET block='1'
WHERE email IN (SELECT db2.table2.email 
            FROM db2.table2
            WHERE db2.table2.status_id='10');

aherigon

Posted 2015-07-15T22:50:24.593

Reputation: 36