我有一张这样的桌子
CREATE TABLE news
(
Id INT NOT NULL auto_increment,Headline VARCHAR (255) NULL,InDateTime DATETIME NULL
)
如何获取每秒记录数(InDateTime)?
我正在使用MysqL
样本记录:
578921,'headline1','8/20/2012 12:01:53 PM'
578922,'headline2','8/20/2012 12:01:53 PM'
578923,'headline3','8/20/2012 12:01:53 PM'
578924,'headline4','8/20/2012 12:01:59 PM'
578925,'headline5','8/20/2012 12:01:59 PM'
578926,'headline6','8/20/2012 12:01:59 PM'
578927,'headline7','8/20/2012 12:01:59 PM'
578928,'headline8','8/20/2012 12:02:03 PM'
预期产量:
time,count
'8/20/2012 12:01:53 PM',3
'8/20/2012 12:01:59 PM',4
'8/20/2012 12:02:03 PM',1
最佳答案
你累了吗:
SELECT COUNT(id),InDateTime
FROM news
GROUP BY InDateTime