当前位置:网站首页>MYSQL GROUP_ The concat function realizes the content merging of the same ID
MYSQL GROUP_ The concat function realizes the content merging of the same ID
2022-07-06 00:33:00 【Turn over the troubled times】
Prepare a table
CREATE TABLE `sc` (
`SId` varchar(10) DEFAULT NULL,
`CId` varchar(10) DEFAULT NULL,
`score` decimal(18,1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `sc` VALUES ('01', '01', 80.0);
INSERT INTO `sc` VALUES ('01', '02', 90.0);
INSERT INTO `sc` VALUES ('01', '03', 99.0);
INSERT INTO `sc` VALUES ('02', '01', 70.0);
INSERT INTO `sc` VALUES ('02', '02', 60.0);
INSERT INTO `sc` VALUES ('02', '03', 80.0);
INSERT INTO `sc` VALUES ('03', '01', 80.0);
INSERT INTO `sc` VALUES ('03', '02', 80.0);
INSERT INTO `sc` VALUES ('03', '03', 80.0);
INSERT INTO `sc` VALUES ('04', '01', 50.0);
INSERT INTO `sc` VALUES ('04', '02', 30.0);
INSERT INTO `sc` VALUES ('04', '03', 20.0);
INSERT INTO `sc` VALUES ('05', '01', 76.0);
INSERT INTO `sc` VALUES ('05', '02', 87.0);
INSERT INTO `sc` VALUES ('06', '01', 31.0);
INSERT INTO `sc` VALUES ('06', '03', 34.0);
INSERT INTO `sc` VALUES ('07', '02', 89.0);
INSERT INTO `sc` VALUES ('07', '03', 98.0);
SEPARATOR Specify the distance , I used spaces here , Don't use SEPARATOR Under the circumstances The default is ‘ comma ’ Apart,
SELECT GROUP_CONCAT(score SEPARATOR ' ') as a FROM `sc` GROUP BY SId
result : as follows
边栏推荐
- MDK debug时设置数据实时更新
- Uniapp development, packaged as H5 and deployed to the server
- 剖面测量之提取剖面数据
- Hardware and interface learning summary
- 云导DNS和知识科普以及课堂笔记
- 【文件IO的简单实现】
- Codeforces round 804 (Div. 2) [competition record]
- Extension and application of timestamp
- Browser reflow and redraw
- [QT] QT uses qjson to generate JSON files and save them
猜你喜欢
MySQL存储引擎
如何制作自己的机器人
认识提取与显示梅尔谱图的小实验(观察不同y_axis和x_axis的区别)
【EI会议分享】2022年第三届智能制造与自动化前沿国际会议(CFIMA 2022)
Introduction of motor
Date类中日期转成指定字符串出现的问题及解决方法
Folding and sinking sand -- weekly record of ETF
Set data real-time update during MDK debug
[designmode] Decorator Pattern
Recognize the small experiment of extracting and displaying Mel spectrum (observe the difference between different y_axis and x_axis)
随机推荐
anconda下载+添加清华+tensorflow 安装+No module named ‘tensorflow‘+KernelRestarter: restart failed,内核重启失败
Hudi of data Lake (2): Hudi compilation
AtCoder Beginner Contest 258【比赛记录】
Comment faire votre propre robot
常用API类及异常体系
Cloud guide DNS, knowledge popularization and classroom notes
Permission problem: source bash_ profile permission denied
Anconda download + add Tsinghua +tensorflow installation +no module named 'tensorflow' +kernelrestart: restart failed, kernel restart failed
Calculate sha256 value of data or file based on crypto++
时间戳的拓展及应用实例
Ffmpeg learning - core module
NLP text processing: lemma [English] [put the deformation of various types of words into one form] [wet- > go; are- > be]
FFT learning notes (I think it is detailed)
notepad++正則錶達式替換字符串
建立时间和保持时间的模型分析
LeetCode 6006. Take out the least number of magic beans
剖面测量之提取剖面数据
Browser reflow and redraw
小程序技术优势与产业互联网相结合的分析
Intranet Security Learning (V) -- domain horizontal: SPN & RDP & Cobalt strike