我有一个产品表,其中包含列 id_str 而不是 id 的重复产品。我们使用 id_str 来跟踪每个产品。这是我迄今为止尝试过的:
创建了一个临时表并将其截断,然后运行以下查询
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
我得到的结果与在原始表上的结果相同。我错过了什么?