tpch_query13.sql 315 B

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