[英]sql query to count distinct
candidate![]() |
position ![]() |
---|---|
john![]() |
referendum![]() |
mark![]() |
referendum![]() |
sofia![]() |
premier![]() |
john![]() |
referendum![]() |
john![]() |
referendum![]() |
sofia![]() |
premier![]() |
mark![]() |
referendum![]() |
sofia![]() |
premier![]() |
anna![]() |
premier![]() |
john![]() |
referendum![]() |
hi guys, T need help with this query to count the results, the output that I what will be:嗨,伙计们,T 需要此查询的帮助来计算结果,我将是什么 output:
john, for the referdum, has 4 votes
mark, for the referdum has 2 votes
sofia, for the premier has 3 votes
anna, for the premier has 1 votes
SELECT DISTINCT
candidate,
position,
count(DISTINCT candidate) over (order by position) AS votes_received
from votes;
this was my query, but says:这是我的查询,但说:
This version of MariaDB does not yet support 'COUNT (DISTINCT) aggregate as window function
此版本的 MariaDB 尚不支持 'COUNT (DISTINCT) 聚合为 window function
thanks for help感谢帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.