github.com/matrixorigin/matrixone@v0.7.0/pkg/sql/plan/tpch/q13.sql (about)

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