Can someone explain (or point in the right direction) how I will move several rows from one table to another and delete a row from the original table based on a given criterion?
I understand
INSERT INTO table2 SELECT * FROM table1
to copy data from one table to another, but I need to delete the original. The reason is that it was suggested to speed up the query of the table, I have to move all redundant data (completed, expired, products older than 3 months) from the main table to another.
A bit of background, I have a table in which the products are stored, some products have expired, but the products should still be available. There are about 50,000 products that have expired and 2,000 are active. There is a status column (int 1 = active, 2 = expired, etc.) to determine what to show on the front panel.
I think this post is 2 questions:
- Is there a better way to speed up querying a product table without removing obsolete items?
- If not, how to move rows from one table to another
Thank you very much!
source share