I have a problem with a MySQL Update statement. I have more than 100.000 Entries in the table. So my approaches were not successful. (see below)
First, I want to count the number of values (thats easy):
SELECT values1 ,count(values1) FROM table
GROUP BY value1
HAVING COUNT(value1) <= 1000;
Second, i want to replace some values of the column values1 which appears only <= 1000 times.
So I tried these statement:
Update table as t
SET t.value1 = "limitAmount"
WHERE EXISTS (select value1 from
(select * from table) as f Group by f.value1
Having count(f.value1) <= 1000);
When i tried this SQL statement, i received:
Error Code 1205. Lock Wait timeout exceeded. Try restarting transaction.