tpch_query4.sql 311 B

123456789101112131415161718192021
  1. select
  2. o_orderpriority,
  3. count(*) as order_count
  4. from
  5. orders as o
  6. where
  7. o_orderdate >= '1996-05-01'
  8. and o_orderdate < '1996-08-01'
  9. and exists (
  10. select
  11. *
  12. from
  13. lineitem
  14. where
  15. l_orderkey = o.o_orderkey
  16. and l_commitdate < l_receiptdate
  17. )
  18. group by
  19. o_orderpriority
  20. order by
  21. o_orderpriority;