concat()用法
Posted 白莲花の
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了concat()用法相关的知识,希望对你有一定的参考价值。
SELECT school_code,`name`,phone from student WHERE login_name REGEXP \'ning$\'LIMIT 10;
concat()
- SELECT CONCAT(school_code,`name`) from student WHERE login_name REGEXP \'ning$\' LIMIT 10;
- SELECT CONCAT(school_code,`name`,phone) from student WHERE login_name REGEXP \'ning$\' LIMIT 10;(有一个字段是null,concat的结果是null)
CONCAT_WS()
- SELECT CONCAT_WS(\'-\',school_code,NAME,login_name,phone) from student WHERE login_name REGEXP \'ning$\' LIMIT 10;
- SELECT `name`,MIN(id) FROM student GROUP BY `name` HAVING COUNT(id) >=2 LIMIT 10;
GROUP_CONCAT()
- SELECT id,`name` from student WHERE `name`=\'刘媛媛\' LIMIT 10;
- SELECT NAME,GROUP_CONCAT(id) from student WHERE `name`=\'刘媛媛\' LIMIT 10;
- SELECT NAME,GROUP_CONCAT(id) FROM student GROUP BY `name` HAVING COUNT(id) >=2 LIMIT 10;
以上是关于concat()用法的主要内容,如果未能解决你的问题,请参考以下文章
mysql中concat 和 group_concat()的用法
mysql中concat 和 group_concat()的用法