8 lines
319 B
SQL
8 lines
319 B
SQL
-- TPC_H Query 13 - Customer Distribution
|
|
SELECT C_COUNT, COUNT(*) AS CUSTDIST
|
|
FROM (SELECT C_CUSTKEY, COUNT(O_ORDERKEY)
|
|
FROM CUSTOMER left outer join ORDERS on C_CUSTKEY = O_CUSTKEY
|
|
AND O_COMMENT not like '%%special%%requests%%'
|
|
GROUP BY C_CUSTKEY) AS C_ORDERS
|
|
GROUP BY C_COUNT
|
|
ORDER BY CUSTDIST DESC, C_COUNT DESC; |