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;