Mysql query for getting count as per two grouping condition

时间:2018-04-20 01:05:45

标签: mysql sql database

I have below data table and need to accomplish the result for Student count as per availability and per department

enter image description here Note: Different Department may come in later.

Updated: Department Table: enter image description here

Want to have result as below: (Student count as per availability and per department)

enter image description here

1 个答案:

答案 0 :(得分:0)

Maybe this could work,

SELECT Department, 
       CONCAT(Studavailability,', ',
              COUNT(*)) 
       as "Stud Count as per availability per department"
FROM Table
Group By Department, Studavailability