MySQL Forums
Forum List  »  Newbie

Select group with hour step
Posted by: Egor Grijuc
Date: February 18, 2014 04:23AM

I have the following table with call records
calldate datetime
caller int
callername varchar
...
What i need is to count each callername per hour
for example table contents
2014-02-18 18:00:00 | 1234 | Agent 1
2014-02-18 18:02:00 | 1234 | Agent 1
2014-02-18 18:10:00 | 1234 | Agent 2
2014-02-18 18:15:00 | 1234 | Agent 2
2014-02-18 18:20:00 | 1234 | Agent 2
2014-02-18 19:20:00 | 1234 | Agent 2
2014-02-18 19:25:00 | 1234 | Agent 2
2014-02-18 19:30:00 | 1234 | Agent 1
the result:
date | name | count times
2014-02-18 18:00:00 | Agent 1 | 2
2014-02-18 18:00:00 | Agent 2 | 3
2014-02-18 19:00:00 | Agent 2 | 2
2014-02-18 19:00:00 | Agent 1 | 1



Edited 1 time(s). Last edit at 02/18/2014 04:24AM by Egor Grijuc.

Options: ReplyQuote


Subject
Written By
Posted
Select group with hour step
February 18, 2014 04:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.