CONCAT substr group_concat find_in_set

(SELECT p.*,(SELECT CONCAT(m.name,m.id) FROM service_fastfix_category m WHERE m.id=SUBSTR(p.id,1,4)) AS parentcode,(SELECT GROUP_CONCAT(ee.name

)FROM ele_part_category ee  WHERE FIND_IN_SET(ee.code,p.m_part_category_ids))AS groupname FROM service_fastfix_category p ORDER BY p.id) a

1、substr()字符串截取功能。

2、concat()连接

SELECT CONCAT(phone,state)AS dd FROM app_user ORDER BY dd

3、FIND_IN_SET(ee.code,p.m_part_category_ids)

找到code在m_part_category_ids的位置

4、group—concat()

SELECT brandid,GROUP_CONCAT(seriesid) AS ss FROM app_user_car  GROUP BY brandid

时间: 2024-12-15 10:35:46

CONCAT substr group_concat find_in_set的相关文章

MySQL教程之concat以及group_concat的用法

MySQL教程之concat以及group_concat的用法 本文中使用的例子均在下面的数据库表tt2下执行: 一.concat()函数 1.功能:将多个字符串连接成一个字符串. 2.语法:concat(str1, str2,...) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为null. 3.举例: 例1:select concat (id, name, score) as info from tt2; 中间有一行为null是因为tt2表中有一行的score值为n

MySQL concat concat_ws group_concat 函数(连接字符串)

CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串.如有任何一个参数为NULL ,则返回值为 NULL. mysql> select concat('11','22','33'); +------------------------+ | concat('11','22','33') | +------------------------+ | 112233 | +------------------------+ mysql> select concat_ws(',','

MySQL中函数CONCAT及GROUP_CONCAT

一.CONCAT()函数CONCAT()函数用于将多个字符串连接成一个字符串.使用数据表Info作为示例,其中SELECT id,name FROM info LIMIT 1;的返回结果为+----+--------+| id | name   |+----+--------+|  1 | BioCyc |+----+--------+1.语法及使用特点:CONCAT(str1,str2,-)                       返回结果为连接参数产生的字符串.如有任何一个参数为NULL

mysql concat和group_concat

mysql concat(str1,str2...)连接两个字符串,(数字也是可以的,会转成字符串) MySQL的concat函数在连接字符串的时候,只要其中一个是NULL,那么将返回NULL mysql> select concat('11','22',null);+------------------------+| concat('11','22',null) |+------------------------+| NULL   |+------------------------+1

mysql中concat 和 group_concat()的用法

一.CONCAT()函数CONCAT()函数用于将多个字符串连接成一个字符串.使用数据表Info作为示例,其中SELECT id,name FROM info LIMIT 1;的返回结果为+----+--------+| id | name   |+----+--------+|  1 | BioCyc |+----+--------+1.语法及使用特点:CONCAT(str1,str2,-)                       返回结果为连接参数产生的字符串.如有任何一个参数为NULL

MySQL中函数CONCAT及GROUP_CONCAT(aggregate)

一.CONCAT()函数 CONCAT()函数用于将多个字符串连接成一个字符串. 使用数据表Info作为示例,其中SELECT id,name FROM info LIMIT 1;的返回结果为 +----+--------+ | id | name   | +----+--------+ |  1| BioCyc | +----+--------+ 1.语法及使用特点: CONCAT(str1,str2,-) 返回结果为连接参数产生的字符串.如有任何一个参数为NULL ,则返回值为 NULL.可

浅析MySQL中concat以及group_concat的使用

说明: 本文中使用的例子均在下面的数据库表tt2下执行: 一.concat()函数 1.功能:将多个字符串连接成一个字符串. 2.语法:concat(str1, str2,...) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为null. 3.举例: 例1:select concat (id, name, score) as info from tt2; 中间有一行为null是因为tt2表中有一行的score值为null. 例2:在例1的结果中三个字段id,name,s

mysql之concat concat_ws group_concat

concat.concat_ws.group_concat都可以用来连接字符串. concat和concat_ws用来连接同一行中不同列的数据,group_ws用来连接同一列的数据. 格式如下: concat(str1, str2, ...) concat_ws(seperator, str1, str2, ...) group_concat([distinct] 列名  [order by 列名 desc/asc] [separator 分隔符]) 原文地址:https://www.cnblo

MySQL的concat以及group_concat的用法

一.concat()函数 1.功能:将多个字符串连接成一个字符串. 2.语法:concat(str1, str2,...) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为null. 3.举例: 例1:select concat (id, name, score) as info from tt2; 中间有一行为null是因为tt2表中有一行的score值为null. 例2:在例1的结果中三个字段id,name,score的组合没有分隔符,我们可以加一个逗号作为分隔符: