[Solved] Joins and/or Sub queries or Ranking functions


Using max(ship_num) is a good idea, but you should use the analytic version (with an OVER clause).

select *
from
(
  select t.*, max(ship_num) over (partition by order_id) as orders_max_ship_num
  from table1 t1
) with_max
where ship_num = orders_max_ship_num
order by order_id, item_code;

0

solved Joins and/or Sub queries or Ranking functions