Guest User

Untitled

a guest
Oct 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. select distinct b.ID_Code, b.supply_start_date, b.supply_end_date, b.system_id
  2. from (
  3. select ID_Code, max(supply_start_date) as max_dt
  4. from tmp_mmt_sup
  5. group by ID_Code) a
  6. inner join tmp_mmt_sup b
  7. on a.ID_Code=b.ID_Code and a.max_dt=b.SUPPLY_START_DATE;
  8.  
  9. ID_Code Start End System
  10. 123 01-04-2018 30-04-2018 ABC
  11. 123 01-04-2018 30-04-2018 DEF
Add Comment
Please, Sign In to add comment