我正在尝试运行查询以根据表达式删除重复项。我试图使用的表达方式就是这个。
category-23023
或category-link-2398
或category-link-url-58693435
基本上,我需要一个表达式来检查-
短划线符号前面的字符串是否包含一个字母后跟一个破折号,最后是一个数字。这是我上次尝试过的不起作用。
delete
from core_url_rewrite using core_url_rewrite,
core_url_rewrite e1
where core_url_rewrite.url_rewrite_id > e1.url_rewrite_id
and core_url_rewrite.target_path = e1.target_path
and core_url_rewrite.target_path RLIKE '^[a-z]+\\-[0-9]$';
答案 0 :(得分:1)
试试这个,应该有用。
delete
from core_url_rewrite using core_url_rewrite,
core_url_rewrite e1
where core_url_rewrite.url_rewrite_id > e1.url_rewrite_id
and core_url_rewrite.target_path = e1.target_path
and core_url_rewrite.target_path RLIKE '^[a-z]+\\-*.*\\-[0-9]+$';
答案 1 :(得分:0)
似乎我能够通过改变Riad的代码来实现这一点。
delete
from core_url_rewrite using core_url_rewrite,
core_url_rewrite e1
where core_url_rewrite.url_rewrite_id > e1.url_rewrite_id
and core_url_rewrite.target_path = e1.target_path
and core_url_rewrite.target_path RLIKE '[a-z]+\\-[0-9]+$';