随机获取表中100条数据
select * from table order by rand() limit 100;
统计表中每10分钟的pv量
select floor(unix_timestamp(window_start)/600),sum(pv_num) from table
where window_start <= date_add(now(),interval -20 minute) and
window_start >= date_add(now(),interval -30 minute)
group by floor(unix_timestamp(window_start)/600)
网友评论