MySQL 查詢部門人數大於2的員工信息

以下表,查詢部門人數大於2的員工信息,並把員工姓名和頭銜一塊兒輸出出來string

1.員工表(employee)it

2.部門表(department)test

3.Sql語句:select

select CONCAT(name,title) ,sex,employee_no,department_id from test.employee where department_id in(select department_id from test.employee group by department_id HAVING(count(department_id)>1));im

4.結果查詢

5.主要Concat(string,string,....)和HAVING()的使用img

6.太晚了,後續補上。。。哇嘎嘎co

相關文章
相關標籤/搜索