任务是说我在客户表中有 4000 个(或 n 个)客户 ID,我需要将它们分配给 4 个人,让他们每个人处理 1000 个(或 N/4)个客户 ID,我尝试了分区,但它给我的结果是错误的 5: 在每条记录中。
SELECT CUSTOMER_ID, Partition (CUSTOMER_ID, 1, 4, (SELECT ROUND(Sum(B.C)/4,0) AS
Employee_ID FROM (SELECT CUSTOMER_ID, Count(CUSTOMER_ID) AS C FROM CUSTOMER GROUP BY
CUSTOMER_NAME) AS B)/4)
FROM CUSTOMER
GROUP BY CUSTOMER_ID;