mysql 的用法
SELECT
CASE
WHEN //当count(userId) = 0的时候 让其为null 不然报警告
// count(DISTINCT userId) 不用处理
count(userId) = 0 THEN
NULL
ELSE
ROUND(
count(userId) / count(DISTINCT userId)
)
END AS r
FROM
video_user_his AS a
WHERE
UNIX_TIMESTAMP(a.createTime) < 1486828800
AND UNIX_TIMESTAMP(a.createTime) > 1486915199