【发布时间】:2016-07-12 07:37:36
【问题描述】:
我有一列包含这样的数据:
http://www.example.com/category/link.html
http://www.example2.com/category2/link.html
http://www.example3.com/directory/category/link.php
http://www.example4.com/category4/link.php
http://www.example5.com/directory/link.html
我想选择这些链接中不同的domain.com 部分,然后将其插入另一列
SELECT DISTINCT REPLACE(domain,'http://www.','') AS domain FROM table;
这会选择没有http://www. 的所有内容如何删除链接的其余部分,所以我留下domain.com,然后将其插入另一列?
【问题讨论】:
标签: mysql select replace substring