blob: 97848f0b9b5a256eea6f4a45d6f3baa3a896b306 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--!syntax_pg
--TPC-H Q13
select
c_count, count(*) as custdist
from (
select
c_custkey,
count(o_orderkey)
from
plato."customer"
left outer join
plato."orders"
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;
|