A
A
ART42018-02-22 17:33:40
MySQL
ART4, 2018-02-22 17:33:40

Duplicate records in mysql why?

Good afternoon, there is a base
bd44fcf34f.png
Structure of its
f2f8b81957.png
Request

INSERT INTO s_products (url,name,brand_id,meta_title,meta_keywords,meta_description)
VALUES ((SELECT max(product_id) FROM s_products_categories),'%Название%','0','%Название%','%Название%','%Название%')
ON DUPLICATE KEY UPDATE `url` = (SELECT product_id FROM s_products_categories),

`name` = '%Название%',

`brand_id` = '0',

`meta_title` = '%Название%',

`meta_keywords` = '%Название%',

`meta_description` = '%Название%'

How to make sure that when adding a record, the name is not duplicated.??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lander, 2018-02-22
@usdglander

Make the 'name' field unique.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question