MYSQL截取列里面的数据为多行
来源:互联网 发布:linux shell 复制粘贴 编辑:程序博客网 时间:2024/06/07 06:42
/**单选统计**/
SELECT syyou,count(syyou) from test_form_one group BY syyou/**复选统计**/
select substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1) as race,count(substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1))
from test_form_one a
join mysql.help_topic b
on b.help_topic_id < (length(a.race) - length(replace(a.race,'|',''))+1)
group BY substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1)
order by a.id;
截取的核心语句为:
select substring_index(substring_index(a.race,'|',b.help_topic_id+1),'|',-1) from test_form_one a
join mysql.help_topic b
on b.help_topic_id < (length(a.race) - length(replace(a.race,'|',''))+1)
order by a.id;
参考的文件地址:http://www.cnblogs.com/cenalulu/archive/2012/08/20/2647463.html
0 0
- MYSQL截取列里面的数据为多行
- 截取text列里面的内容
- Mysql查询将列里面的值替换为别的值但是实际值不变
- 行转列,多列的数据合并为一行,行转换
- Mysql行转换为列
- phpmyadmin导出mysql查询的数据为excel分号格式转换为列
- mysql插入一条数据之后(ID为自动增长列),返回该条数据的ID
- MySQL数据库行转换为列的2种方法
- mysql 数据截取错误
- mysql数据截取
- 数据窗口对象里面列的格式复制
- 将MYSQL查出来的数据从三列转化为一列
- MySQL 改变列的数据类型为ENUM
- mysql 一行数据+标题转换为两列
- GridView表格列数据字符截取
- MYSQL多列数据合并成1行
- mysql 导出特定列的数据
- 查询EXCEL数据时,列数据为空的问题
- 合并排序数组 II——LintCode
- 【Codeforces Round 275 (Div 2)E】【状压DP 概率DP求期望 线性相加思想 二进制系统函数】Game with Strings n个串目标串随机猜位置随机的猜出答案的期望步
- JAVA GC调优零碎记录
- 【SSH快速进阶】——Hibernate一对一映射(one-to-one)——唯一外键关联
- java中HashMap,LinkedHashMap,TreeMap,HashTable的区别
- MYSQL截取列里面的数据为多行
- mysql命令
- mysql安装后简单的配置(以5.6.22 x64为示例)
- HD_1312 Red and Black
- 关于iOS SDK9.0 不能用http请求的解决办法
- 电商分享问题
- 新博客开张,欢迎前来吐槽~
- 【博弈论】Codeforces Round #334 (Div. 2) E
- C# 判断一个时间点是否位于给定的时间区间(字符串格式)