我是MySQL的新手,我想提出一个基本上可以做到的查询:
select * from tasks where completed = 1;
除以…
select * from tasks where completed = 0;
我一直在寻找解决方案,但只找到了对两个表或行之间的实际值求平均值的方法,但没有对行项进行计数的方法。任何帮助将不胜感激!
这应该工作:
select (select count(*) from tasks where completed = 1) / (select count(*) from tasks where completed = 0) from dual