我有一個產品表,其中包含id_str列而非id列的重複產品。我們使用id_str來跟蹤每個產品。這是我試過到目前爲止:無法刪除mysql中的重複記錄
創建一個臨時表,並截斷它,然後跑下面的查詢
INSERT INTO products_temp SELECT DISTINCT id_str, id, title, url, image_url, long_descr, mp_seller_name, customer_rating, curr_item_price, base_item_price, item_num, rank, created_at, updated_at, published, publish_ready, categories, feed_id, category_names, last_published_at, canonical_url, is_curated, pr_attributes, gender, rating, stock_status, uploadedimage_file_name, updated_by, backfill_text, image_width, image_height, list_source, list_source_time, list_category, list_type, list_image, list_name, list_domain, notes, street_date, list_product_rank, created_by from products
當我搜索的新表重複ID_STR的這個移動所做的一切不過:
SELECT id_str, COUNT(*) C FROM PRODUCTS GROUP BY id_str HAVING C > 1
我得到了和原始表一樣的結果。我錯過了什麼?