SELECT d.DepName,
nA1 = SUM(CASE WHEN ru.RoomCode='A1' THEN 1 END),
nA2 = SUM(CASE WHEN ru.RoomCode='A2' THEN 1 END),
nA3 = SUM(CASE WHEN ru.RoomCode='A3' THEN 1 END),
...
nTotal = COUNT(*)
FROM Department As d
INNER JOIN RoomUsage as ru ON d.DepCode=ru.DepCode
GROUP BY d.DepName
SELECT COUNT(*) AS TOTAL
FROM RESERVATION AS a LEFT OUTER JOIN
ORDER_ROOM AS b ON a.Reserve_ID = b.Reserve_ID LEFT OUTER JOIN
MASTER_ROOM AS c ON b.Room_ID = b.Room_ID
WHERE (a.Dept_ID = '901') AND (b.Room_ID = '006')