使用group by子句时的差异

时间:2017-07-25 11:09:18

标签: group-by google-bigquery

由于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
);

0 个答案:

没有答案