All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sql.presto.tpch.q13.sql Maven / Gradle / Ivy

There is a newer version: 350
Show newest version
SELECT 
  c_count, 
  count(*) as custdist
FROM (
  SELECT 
    c.custkey, 
    count(o.orderkey)
  FROM 
    "${database}"."${schema}"."${prefix}customer" c
    LEFT OUTER JOIN
    "${database}"."${schema}"."${prefix}orders" o
  ON 
    c.custkey = o.custkey
    AND o.comment NOT LIKE '%special%requests%'
  GROUP BY c.custkey
) AS c_orders (c_custkey, c_count)
GROUP BY 
  c_count
ORDER BY 
  custdist DESC, 
  c_count DESC
;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy