You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
468 B
28 lines
468 B
3 years ago
|
--begin q13
|
||
|
-- $ID$
|
||
|
-- TPC-H/TPC-R Customer Distribution Query (Q13)
|
||
|
-- Functional Query Definition
|
||
|
-- Approved February 1998
|
||
|
:x
|
||
|
:o
|
||
|
select
|
||
|
c_count,
|
||
|
count(*) as custdist
|
||
|
from
|
||
|
(
|
||
|
select
|
||
|
c_custkey,
|
||
|
count(o_orderkey)
|
||
|
from
|
||
|
tpch.customer left outer join tpch.orders on
|
||
|
c_custkey = o_custkey
|
||
|
and o_comment not like '%:1%:2%'
|
||
|
group by
|
||
|
c_custkey
|
||
|
) as c_orders (c_custkey, c_count)
|
||
|
group by
|
||
|
c_count
|
||
|
order by
|
||
|
custdist desc,
|
||
|
c_count desc;
|
||
|
--end q13
|