I have a query which matches records with similar 7 and 6 digit primary keys...
I wish to delete the matching 7 digit records only...
The query below returns: '#1242 - Subquery returns more than 1 row'
I know I could write a loop in PHP to accomplish this; but, would like to write a proper query in MySQL to accomplish same...
The join matches 6 digit keys to 7 digit ones with a leading '1'...
Query:
Thanks in advance for suggestions on how to resolve...
-A
I wish to delete the matching 7 digit records only...
The query below returns: '#1242 - Subquery returns more than 1 row'
I know I could write a loop in PHP to accomplish this; but, would like to write a proper query in MySQL to accomplish same...
The join matches 6 digit keys to 7 digit ones with a leading '1'...
Query:
Code:
DELETE FROM `mbbgmc_eraq_ro_2016-05-03` WHERE `roid` = (
SELECT z.x FROM (
SELECT `six`.`roid`, `seven`.`roid` as x
FROM `mbbgmc_eraq_ro_2016-05-03` as seven
INNER JOIN `mbbgmc_eraq_ro_2016-05-03` as six
ON `seven`.`roid` LIKE CONCAT('1',`six`.`roid`)
WHERE `seven`.`postdate` > '2016-03-20') as z )
Thanks in advance for suggestions on how to resolve...
-A