Im trying to delete a row in MySql if there are 2 rows for a merchant. It doesn't matter which row is deleted.
When I run:
SELECT * FROM products.merchant_configs WHERE `configKey` = 'CHECK_BALANCE_SUBJECT'
AND merchantId = 6;
I see:
Now I try to delete one of the rows:
DELETE FROM products.merchant_configs
WHERE id = (
SELECT id FROM products.merchant_configs WHERE `configKey` = 'CHECK_BALANCE_SUBJECT'
AND merchantId = 6
LIMIT 2 OFFSET 1
);
I receive the error:
Error Code: 1093. You can't specify target table 'merchant_configs' for update in FROM clause
What's going on?