dongquexi1990 2014-09-23 09:04
浏览 87
已采纳

如何在MySQL或PHPMyAdmin中使用通配符删除条目

This is the table which I've get I want to delete entries which are not having _01.jpg in PHPMyAdmin or MySQL

+----+------+---------------------------+-------+--------------------------------------+
| id | nid  |           path            | style |           image_name_path            |
+----+------+---------------------------+-------+--------------------------------------+
|  1 | 1002 | 1234567 U14RNMT02_01.jpg  |   123 | 1234567-U14RNMT02-SM14B6_01-245.jpg  |
|  2 | 1003 | 1234567 U14RNMT02_02.jpg  |   123 | 1234567-U14RNMT02-SM14B6_02-245.jpg  |
|  3 | 1004 | 1234567 U14RNMT02_03.jpg  |   123 | 1234567-U14RNMT02-SM14B6_03-245.jpg  |
|  4 | 1005 | 1234567 U14DRYMT07_01.jpg |   123 | 1234567-U14DRYMT07-SM14B6_01-245.jpg |
|  5 | 1006 | 1234567 U14DRYMT07_02.jpg |   123 | 1234567-U14DRYMT07-SM14B6_02-245.jpg |
|  6 | 1007 | 1234567 U14DRYMT07_03.jpg |   123 | 1234567-U14DRYMT07-SM14B6_03-245.jpg |
+----+------+---------------------------+-------+--------------------------------------+
  • 写回答

2条回答 默认 最新

  • donglu9825 2014-09-23 09:08
    关注

    Do it with sql query. The % sign check the _01.jpg in the last of the path fields string.

    delete from table_name where path not like '%_01.jpg' 
    

    Take a look on pattern-matching for more details.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题