-2

I want to find duplicate data with this query which may occur during insertion. Is there any way to find it?

INSERT INTO table_tags (tag) VALUES ('tag_a'),('tab_b'),('tag_c')
ON DUPLICATE KEY UPDATE tag=tag;
Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58
Pankti Shah
  • 35
  • 1
  • 7
  • Assuming tag is a uniquely keyed column, SELECT tag FROM table_tags WHERE tag IN ('tag_a','tab_b','tag_c'), but does seem pointless. By the way you are missing VALUES from the update (probably irrelevant in this case) – Kickstart Jan 20 '14 at 12:27

1 Answers1

1

Try something like this

INSERT INTO table_tags
   (tag)
VALUES
   (?)
ON DUPLICATE KEY UPDATE
   tag     = VALUES('tag_a')

Note that, column tag should be unique

Linga
  • 10,379
  • 10
  • 52
  • 104