由于group by子句,我发现计数存在差异,请告知如何解决这个问题。
当我计算(you_id)时,表中的总记录是4638,但是当我运行此脚本时,我只获得了4544条记录。
SELECT
thumbnails,
CR1,
monetize,
c_id,
you_id,
vendor,
ratio * 100 AS percent
FROM
(
SELECT thumbnails, c_id,you_id, vendor,CR1,monetize,timestamp,
count(*) AS total, RATIO_TO_REPORT(total) OVER() AS ratio
FROM testing
GROUP by 1,2,3,4,5,6,7
);