INSERT INTO order SELECT * FROM order WHERE date > DATE_SUB(NOW(), INTERVAL 6 MONTH);
I am getting Error Code: 1062
Duplicate entry '5890738' for key 'PRIMARY'
How to resolve this as I want only 6 months data but this table contains 6 years data?
What you get as error means that you try to insert id (which a primary and unique key) twice times, to solve that you must use something like that :
Note : Id must be auto-increment column