0

这是我的基本mysql查询,用于计算每日用户数,所以我需要从2012-01-30到2012-02-19执行,而不是手动修改,有什么好的方法吗?

select count(distinct user) FROM video WHERE date >= '2012-01-30 00:00' AND date <= '2012-01-30 23:55';


select count(distinct user) FROM video WHERE date >= '2012-01-31 00:00' AND date <= '2012-01-31 23:55';

...
4

1 回答 1

2
SELECT DATE(date) AS date, COUNT(DISTINCT user) FROM video
WHERE date >= '2012-01-30 00:00' AND date_pl <= '2012-02-19 00:00'
GROUP BY DATE(date)
于 2012-08-07T13:36:35.057 回答