SELECT substring_index(substring_index(t.delid,',', b.help_topic_id + 1), ',', -1) FROM (SELECT su.* FROM sys_user su ) t join mysql.help_topic b ON b ...
分类:
其他好文 时间:
2017-11-04 18:09:01
阅读次数:
154
1. 代码 2. 需求的来源 2.1 符合活动条件的订单 达标情况查询 如下页面所示 2-1 2.2 活动相关的表 活动表2-2 符合条件订单表2-3 2.1图中 活动参与状态的查询条件 是在这两个表中不存在的字段 需从活动表2-2中 获取 driver_award_condition列 并分割条件 ...
分类:
数据库 时间:
2017-11-01 18:14:45
阅读次数:
266
MySQL 字符串截取函数:left(), right(), substring(), substring_index()。还有 mid(), substr()。其中,mid(), substr() 等价于 substring() 函数,substring() 的功能非常强大和灵活。 1. 字符串截 ...
分类:
数据库 时间:
2017-10-12 13:01:08
阅读次数:
189
问题:将一个IP地址字段分解到列中,考虑下面列出的IP地址: 111.22.3.4 要得到如下所示的查询结果: + + + + +| a | b | c | d |+ + + + +| 111 | 22 | 3 | 4 |+ + + + + 解决方案: select substring_index( ...
分类:
其他好文 时间:
2017-09-14 23:24:45
阅读次数:
140
substring_index(str,delim,count) str:要处理的字符串 delim:分隔符 count:计数 例子:str=www.baidu.com substring_index(str,'.',1) 结果是:www substring_index(str,'.',2) 结果是 ...
分类:
数据库 时间:
2017-08-17 14:44:55
阅读次数:
241
string s = "我爱北京天安门和长城";string s1 = "北京"; string s2 = "和"; int i = s.IndexOf(s1) + s1.Length+1; int j = s.IndexOf(s2); string str = s.Substring(i, j - ...
1、substring_index(不准确):SELECT*FROM`tvmars_channel`WHERE`name`IN(‘张艺谋‘,‘1080P‘,‘香港电影‘,‘好莱坞‘,‘喜剧电影‘,‘动作电影‘)orderbysubstring_index(‘张艺谋,1080P,香港电影,好莱坞,喜剧电影,动作电影‘,name,1);2、find_in_set:SELECT*FROM`tvmars_channel`WHER..
分类:
数据库 时间:
2017-07-20 11:38:07
阅读次数:
223
某个字段oldNum中存储的为:"1,2,3,4,5";还有可能"10,11,12,13,14"类似这种情况。一开始考虑使用:mysql的LOCATE()函数。但是发现实现不了。因为逗号前的长度不确定。最好可以决定使用substring_index(oldNum,‘,‘,3)这个函数。用逗号分隔后,取逗号的数量前的数据。
分类:
数据库 时间:
2017-07-10 17:59:50
阅读次数:
161
indexof 找到的字符位置是 字符串从0位开始算起的。 lastIndexOf也一样,http://localhost:8080/aaa,的lastIndexOf("/")是21位。 substring(0,a)截取的是,从0位开始算起的,直到第(a-1)位字符,不包含a位字符,例如: var ...
分类:
其他好文 时间:
2017-06-25 12:46:18
阅读次数:
186
MySQL常见的字符串函数整理自官档。1.1SUBSTRorSUBSTRINGSUBSTR(str,pos),SUBSTR(strFROMpos),SUBSTR(str,pos,len),SUBSTR(strFROMposFORlen)SUBSTR()isasynonymforSUBSTRING().SUBSTRING(str,pos),SUBSTRING(strFROMpos),SUBSTRING(str,pos,len),SUBSTRING(strFROMposFORlen)T..
分类:
数据库 时间:
2017-06-23 15:40:20
阅读次数:
467