I have below data table and need to accomplish the result for Student count as per availability and per department
Note: Different Department may come in later.
Want to have result as below: (Student count as per availability and per department)

I have below data table and need to accomplish the result for Student count as per availability and per department
Note: Different Department may come in later.
Want to have result as below: (Student count as per availability and per department)

First you need to get count by department,studavailablity on a subquery.then use GROUP_CONCAT function to create the studCount by subquery.
If you want to show Yes in front of No you could Add order by on GROUP_CONCAT function.
You can try this.
SELECT department,GROUP_CONCAT(Concat(studavailablity,' ',c) order by 1 DESC) 'count'
FROM(
SELECT count(1) c,department,studavailablity
FROM T
GROUP BY studavailablity,department
) t
group by department
order by department desc
sqlfiddle:http://sqlfiddle.com/#!9/c4e56f/16
How about SELECT Department, Studavailability, COUNT(*) FROM students GROUP BY Department, Studavailability;? Best of luck!