1
0

tpch_query12.sql 540 B

12345678910111213141516171819202122232425262728
  1. select
  2. l_shipmode,
  3. sum(case
  4. when o_orderpriority = '1-URGENT'
  5. or o_orderpriority = '2-HIGH'
  6. then 1
  7. else 0
  8. end) as high_line_count,
  9. sum(case
  10. when o_orderpriority <> '1-URGENT'
  11. and o_orderpriority <> '2-HIGH'
  12. then 1
  13. else 0
  14. end) as low_line_count
  15. from
  16. orders,
  17. lineitem
  18. where
  19. o_orderkey = l_orderkey
  20. and l_shipmode in ('REG AIR', 'MAIL')
  21. and l_commitdate < l_receiptdate
  22. and l_shipdate < l_commitdate
  23. and l_receiptdate >= '1995-01-01'
  24. and l_receiptdate < '1996-01-01'
  25. group by
  26. l_shipmode
  27. order by
  28. l_shipmode;