douzai6337 2015-02-13 19:50
浏览 39
已采纳

Sql substring_index删除非永久链接地址

I'm trying to get all the results in my database that match a specific query.

Right now the way I have it is basically selecting only the root domain.

For example I have in my database:

www.website.com/hello www.website.com/

I only select www.website.com/ right now but instead I want to select only domains that have something after the slash (/) and display them in a table.

Here is my code - I tried adding things before and after the '/' and playing around with the number '3' or '-3' but nothing gives me the result I want.

SELECT SUBSTRING_INDEX(url, '/', 3) FROM crawldomains;
  • 写回答

1条回答 默认 最新

  • duan0065626385 2015-02-13 19:54
    关注

    You can try this:

    SELECT url FROM crawldomains WHERE `url` RLIKE '^(http://|https://)?.*\\..*/.+$'
    

    I hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿
  • ¥15 Matlab在app上输入带有矩阵形式的初始条件发生错误
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址