title: Query optimization in SqlServerCe Compact Edition
body: <p>I'm using SqlserverCe compact edition in my application.
  I'm using the left join in query.
  Sqlce taking more time to execute.
  below is code</p>
  
  <pre><code>SELECT calllog.consolename AS consolename, 
         COUNT(consolename)  AS totalcalls, 
         sub.cnt             AS emergencycalls 
  FROM   calllog 
         LEFT JOIN (SELECT consolename, 
                           COUNT(*) AS cnt 
                    FROM   calllog 
                    WHERE  emergencycall = 'False' 
                           AND ( begintime &gt;= '3/6/2011 10:52:39 AM' 
                                 AND endtime &lt;= '10/25/2011 6:52:39 PM' ) 
                    GROUP  BY consolename) AS sub 
           ON calllog.consolename = sub.consolename 
  WHERE  ( begintime &gt;= '3/6/2011 10:52:39 AM' 
           AND endtime &lt;= '10/25/2011 6:52:39 PM' ) 
  GROUP  BY calllog.consolename, 
            sub.cnt 
  ORDER  BY totalcalls ASC 
  </code></pre>
  
  <p>please help me how can I avoid the complexty</p>