i have two tables, tableA and tableB, tableA is phone master record and tableB contains the update status of the last transctions within the phone records of tableA. I want to update value tableA.active to b’0′ for all records in tableB.status=’ERROR’.
This is the MySQL statement that i came with, but is giving me the error (Error Code: 1242. Subquery returns more than 1 row)
UPDATE tableA set tableA.active = b'0'
where
tableA.phone =
(Select phone from tableB where tableB.status='ERROR');
=cannot only match one row, as the error said. You can useINinstead: