github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/benchmark/tpch/03_QUERIES/q13.sql (about)

     1  use tpch;
     2  select
     3  	c_count,
     4  	count(*) as custdist
     5  from
     6  	(
     7  		select
     8  			c_custkey,
     9  			count(o_orderkey)
    10  		from
    11  			customer left outer join orders on
    12  				c_custkey = o_custkey
    13  				and o_comment not like '%pending%accounts%'
    14  		group by
    15  			c_custkey
    16  	) as c_orders (c_custkey, c_count)
    17  group by
    18  	c_count
    19  order by
    20  	custdist desc,
    21  	c_count desc
    22  ;