Take the 2-minute tour ×

I have a various date times stored as strings in my sqlserver database.


This column is called datetimesent and it is quite easy to select group by on it. For example:

SELECT DateTimeSent, COUNT(*) FROM MyTable where group by DateTimeSent

This will group be every second. What I'd like to do is group by every ten seconds, so instead of grouping by the entire string, group by all of it except last letter. How do I do this?


share|improve this question

1 Answer 1

You should consider the use of datetime instead but this will do what you want.

group by left(DateTimeSent, 19)
share|improve this answer

Your Answer


