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
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 >= '3/6/2011 10:52:39 AM'
AND endtime <= '10/25/2011 6:52:39 PM' )
GROUP BY consolename) AS sub
ON calllog.consolename = sub.consolename
WHERE ( begintime >= '3/6/2011 10:52:39 AM'
AND endtime <= '10/25/2011 6:52:39 PM' )
GROUP BY calllog.consolename,
sub.cnt
ORDER BY totalcalls ASC
please help me how can I avoid the complexty
Make sure you have an index for BeginTime, EndTime, EmergencyCall, etc.