首页 > 其他 > 详细

查询出menupath字段中 出现 “- "(横杆)大于3次的 记录

时间:2014-09-27 00:02:00      阅读:355      评论:0      收藏:0      [点我收藏+]

bubuko.com,布布扣

表明为productclass    我想查询出menupath字段中 出现 “- "(横杆)大于3次的 记录

答:1 
select from productclass  where menupath  REGEXP ‘[[:digit:]]+-[[:digit:]]+-[[:digit:]]+-‘  这样就可以 不过不建议用正则查询出menupath字段中 出现 “- "(横杆)大于3次的 记录

2

select * from productclass   where length(menupath) - length(replace(menupath,‘-‘,‘‘))  >3

查询出menupath字段中 出现 “- "(横杆)大于3次的 记录

原文:http://www.cnblogs.com/M-D-Luffy/p/3995751.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!