尝试使用分区统计mysql中的不同用户

尝试使用分区统计mysql中的不同用户,mysql,sql,partitioning,Mysql,Sql,Partitioning,我试图在一天内获得数据库中不同用户的数量。我的数据在一个本地mysql数据库中,这个按代码划分的分区没有给我所需的计数 select date(created) as created_at, count(distinct user_id) over (PARTITION by date(created)) as ytd_count from testdb.request_log; SQL Workbench在(p 请帮助?也许这正是您想要的: select date(created) as

我试图在一天内获得数据库中不同用户的数量。我的数据在一个本地mysql数据库中,这个按代码划分的分区没有给我所需的计数

select date(created) as created_at,
count(distinct user_id) over (PARTITION by date(created)) as ytd_count 
from testdb.request_log;
SQL Workbench在(p


请帮助?

也许这正是您想要的:

select date(created) as created_at, count(distinct user_id) as ytd_count
from testdb.request_log
group by date(created);

MySQL不支持窗口/分析函数。不过,在这种情况下,我认为聚合可以满足您的需要。

MySQL不支持窗口/分析函数。我试过了。我想得到的是这样的结果。