时间:2021-07-01 10:21:17 帮助过:16人阅读
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
mysql 的用法
标签:bsp null ase sel count mysql time tin amp