Mysql group_contact()

1. 表格内容

Mysql group_contact()

 

 

2.  分组查询,查出各部门人数,以及各部门员工姓名

select edept,count(*),group_concat(ename) from emp_info a group by edept;

Mysql group_contact()

 

3. 分组查询,查出各部门人数,以及各部门员工姓名,salary,kpi

查询1:

select edept,count(*),group_concat(ename,salary,kpi) from emp_info a group by edept;

结果1:

Mysql group_contact()

 

查询2:

select edept,count(*),group_concat(ename," ",salary," ",kpi) from emp_info a group by edept;

结果2:

Mysql group_contact()

 

Mysql group_contact()

上一篇:Mysql decimal()


下一篇:sqlit3