SELECT
E1.PointID,
(SELECT count(EmpCode) FROM master_emp E2
WHERE (EmpTypeID =1) and E1.PointID= E2.PointID
GROUP BY PointID) as STT,
(SELECT count(master_emp.EmpCode) FROM master_route
INNER JOIN pointmapping
ON (master_route.routeid = pointmapping.RouteID)
INNER JOIN master_point
ON (master_point.PointID = pointmapping.PointID)
INNER JOIN master_emp
ON (master_emp.PointID = master_point.PointID)
WHERE (master_route.RouteMap =0) and EmpTypeID = 2 and EmpOther = 0 and E1.PointID= pointmapping.PointID
GROUP BY master_point.PointID) as Sub,
(SELECT count(master_emp.EmpCode) FROM master_route
INNER JOIN pointmapping
ON (master_route.routeid = pointmapping.RouteID)
INNER JOIN master_point
ON (master_point.PointID = pointmapping.PointID)
INNER JOIN master_emp
ON (master_emp.PointID = master_point.PointID)
WHERE (master_route.RouteMap =1) and EmpOther = 1 and E1.PointID= pointmapping.PointID
GROUP BY master_point.PointID) as Other
FROM
master_emp E1
GROUP BY E1.PointID, E1.EmpTypeID