How to write sub quries in mysql : Here i joining three tables and taking count [MY SQL FIDDLE][1].In this query i want to take one more count like total_trip that means i already join trip_details tables, **in this table take all count that is total trip count**, i am not able to write sub query, if any one know kindly update my sql fiddle

   

     SELECT COUNT(T.tripId) as Escort_Count,
    (
        SELECT COUNT(*) FROM 
        (
            SELECT a.allocationId
            FROM escort_allocation a 
            INNER JOIN cab_allocation c ON a.allocationId = c.allocationId 
            WHERE c.allocationType = 'Adhoc Trip' 
            GROUP BY a.allocationId
        ) AS Ad
    	
    ) AS Adhoc_Trip_Count 
    FROM 
    ( 
        SELECT a.tripId FROM 
        trip_details a 
        INNER JOIN 
        escort_allocation b 
        ON a.allocationId = b.allocationId 
        GROUP BY a.allocationId 
    ) AS T


  [1]: http://sqlfiddle.com/#!9/e34392/25