当前位置:网站首页>MySQL multi line data synthesis one line function group_ CONCAT
MySQL multi line data synthesis one line function group_ CONCAT
2022-07-21 17:27:00 【February 16】
When we operate data , Sometimes you need to put multiple rows of data , Put it together in a line , Use characters ( For example, comma ) Separate ,SQLSERVER have access to for xml path In the form of ,MySQL The corresponding function is also provided GROUP_CONCAT, To deal with the needs of this scenario .
The usage function :
GROUP_CONCAT([DISTINCT] Fields to connect [ORDER BY Sort field ASC/DESC] [SEPARATOR ' Separator '])
Test data :
SELECT
pushuserid,
orderkeywords
FROM
xn_keywords
ORDER BY pushuserid
Use functions to handle :
SELECT
pushuserid,
GROUP_CONCAT(
`orderkeywords`
ORDER BY
pushuserid SEPARATOR ','
) orderkeywords
FROM
xn_keywords
GROUP BY
pushuserid
give the result as follows :
边栏推荐
- Cmake Quick Guide
- Analysis of tars source code 22
- 工作经验总结1
- tars源码分析之27
- 如何用度量数据驱动代码评审的改善
- 设计分享|单片机直流电机转速控制(汇编)
- 华为无线设备配置同一业务VLAN的AP间快速漫游
- 为什么用了大牌工具后报表开发依然头痛
- CMake 快速指南
- Poor CDH cluster: there are 1855 blocks with insufficient replicas in the cluster. There are 1857 blocks in the cluster. Percentage of blocks with insufficient copies: 99.89%. Critical threshold: 40.0
猜你喜欢
JS -- basic grammar
三级调度之间的联系及区别
Kubernetes service load balancing implementation mechanism
Practice - how many threads are appropriate to create
It seems to be a bug of thread pool, but I think the source code design is unreasonable.
封装全局input组件,并通过v-model绑定父子数据
Huawei wireless devices are configured with rapid roaming between APs of different service VLANs
超简单的三管无感无刷三相电机驱动板
华为无线设备配置同一业务VLAN的AP间快速漫游
Regression prediction analysis of jujube genetics based on support vector machine
随机推荐
二叉树的三种层序遍历BFS
思科配置单臂路由的实际案例,很简单
Interview must ask, how to ensure the idempotency of the interface?
进程控制块(PCB) 包含哪些信息
Kubernetes service load balancing implementation mechanism
面试题 02.05. 链表求和
进程的创建(创建原语,引起其发生的事件)
[pictures and texts] this article explains the JVM architecture, class file structure and bytecode structure!!
Monitor Deep Learning Training Progress
两地三中心部署
Kubernetes deploy mysql5.7 (single node)
Ccs3 comprehensive experiment -- stylesheet file -- design a menu page
Ultra simple three tube inductive brushless three-phase motor drive board
工作经验总结1
[solution] VC6.0 cannot be debugged at breakpoints
华为无线设备配置同一业务VLAN的AP间快速漫游
Solve the problem that @valid list parameters cannot be verified
有了线程后,发生的变化
Es basic knowledge and common query basis
各大主流编程语言性能PK,结果出乎意料