我必须每小时根据日期时间从数据库中获取数据,我尝试了但却无法理解..我是sql的新手,请你帮我。我正在尝试在一小时内为特定用户获取他执行了多少操作的数据
select username,count(message) as '8-9',count(message) as '9-10',count(message) as '10-11'
from customer_1.audit_trail
inner join inteliviz.user on customer_1.audit_trail.user_id = inteliviz.users.id
where datetime>'2013-08-21 08:00:00' and datetime<'2013-08-21 09:00:00'
group by username limit 1000;
答案 0 :(得分:0)
在
之间使用select username,count(message) as '8-9',count(message) as '9-10',count(message) as '10-11'
from customer_1.audit_trail
inner join inteliviz.user on customer_1.audit_trail.user_id = inteliviz.users.id
where datetime between '2013-08-21 08:00:00' and '2013-08-21 09:00:00'
group by username limit 1000;