Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图找出用户的总体比例。基本上我需要查看两列来计算比率,total_emails 和 total_hours。
SELECT sum(total_emails/total_hours) as ratio FROM table WHERE id= 1 LIMIT 0, 1;
这似乎多次将比率相加,当我应该得到像 0.45 这样的数字时,我得到了一个像 8.45 这样的数字
知道我做错了什么吗?
尝试:
SELECT sum(total_emails) / SUM(total_hours) as ratio FROM table WHERE id = 1 LIMIT 0, 1;