I have a problem with the following query:
insert into table
select *
from table
on duplicate key update field1 = field1 + 10
I'm trying to update a field in 1 table, of course I cannot use UPDATE statement because I need to update all the rows in the table. When I try to execute the query mysql returns me the error:
ERROR 1052 (23000): Column 'field1' in field list is ambiguous
"table" and "field1" are example names
--UPDATE--
the query could also be:
insert into table
select *
from table
where field2 < 1000
on duplicate key update field1 = field1 + 10
I even tryed:
update table
set field1 = field1 + 10
where field2 < 1000
But all the rows updated have field1 = 10, the sum doesn't work