Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如在以下数据中:
(1157) (1157 1157 1145) mydog5456
如果我想修剪(并)在我的表中,并且如果他们在替换后记录已经存在,则删除该记录。我应该运行什么sql?
(
)
IE 结果将是
1157 1145 mydog5456
UPDATE your_table SET your_field = REPLACE(your_field, '(', ''); UPDATE your_table SET your_field = REPLACE(your_field, ')', ''); UPDATE your_table SET your_field = TRIM(your_field ); ALTER IGNORE TABLE your_table ADD UNIQUE(your_field);