Can any one please suggest me whats the wrong with my query.
SELECT SUM(cCallDuration), COUNT(*), AVG(cCallduration),
cBeginTime, cEndTime, cAnswerTime, cCallDuration, cDispatcherName, cConsoleName,
cEndpointName, cProfileName, cCallDirection, cCallType,
cCallNature, cCallData, cDirectedCall
FROM CALLINFO
WHERE cBeginTime >='7/11/2011 12:00:00 AM'
AND cEndTime <='7/11/2011 12:00:00 AM'
AND cCallType='InBound'
GROUP BY cConsoleName
I'm getting this error:
In aggregate and grouping expressions, the SELECT clause can contain only aggregates and grouping expressions. [ Select clause = ,cBeginTime ]
'7/11/2011 12:00:00 AM'is not a safe format for a datetime literal - depending on settings, SQL Server may interpret that date as 7th November or 11th July.'2011-07-11T12:00:00'would be safely, unambiguously, 11th July. Also, if you want time to default to midnight, you can omit the time portion - use'20110711'in that case.