Ho to use BETWEEN condition using using main query and sub quries : Here i am using `JOIN` in 3 tables and getting the count.and also `mysql` query working perfect , now my question is i want to add one `BETWEEN` condition in my main query, here [SQL FIDDLE][1] you can check my table schema .**trip_details** table i have one column called `tripDate` using this column only i have to use `BETWEEN` condition in main query


  [1]: http://sqlfiddle.com/#!9/99a87c

> MYSQL

        SELECT COUNT(T.tripId) as Escort_Count,
      (
          SELECT COUNT(*) FROM 
          (
              SELECT a.allocationId
              FROM trip_details 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,
      (SELECT COUNT(id) FROM trip_details) as Total_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 

