I
I
Ivan2021-02-09 20:52:36
MySQL
Ivan, 2021-02-09 20:52:36

How to remove products and seo url from opencart 3 database?

When uploading goods to the site, an error occurred and many goods were unloaded several times, duplicates appeared, some goods even had not one, but 3-4 duplicates at once. The only difference between them is the date of creation and the fact that the duplicates do not have a normal cnc. I want to remove duplicates, but cleaning more than 100,000 with my hands is very, very long. Maybe there is some way to remove products from the database using a query? If possible, can you somehow delete it with a link to the seo url table and the last date in order to leave only the latest versions of the goods and the normal NC?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VVCh, 2021-02-10
@VVCh

Would you like to write a request?
You need to join two tables (actually more)
how can you identify duplicates?
do you have an unambiguous definition(field)
model, sku
Or at least a name?
DELETE t1
FROM product as t1
JOIN product as t2 ON t1.model = t2.model
WHERE t1.product_id <> t2.product_id
AND t1.date_modifacation < t2.date_modification
first make a backup
Then
some queries to delete records from dependent tables
product_*
Their can also be attached to the deletion script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question