mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-22 02:34:20 +01:00
21 lines
318 B
SQL
21 lines
318 B
SQL
select
|
|
c_count,
|
|
count(*) as custdist
|
|
from
|
|
(
|
|
select
|
|
c_custkey,
|
|
count(o_orderkey) as c_count
|
|
from
|
|
customer left outer join orders on
|
|
c_custkey = o_custkey
|
|
and o_comment not like '%express%packages%'
|
|
group by
|
|
c_custkey
|
|
) as c_orders
|
|
group by
|
|
c_count
|
|
order by
|
|
custdist desc,
|
|
c_count desc;
|