SQL Joins : How can i get latest record from 2nd table (one to many relationship)
row_number()

select * from 
(
select *
     , row_number() over (partition by table2.prod_code order by table2.date desc) as rn
from table1 
join table2 
  on table1.prod_code = table2.prod_code 
) tt 
where rn = 1