I am lookign for the correct SQL code to join 2 tables and show only the last record of the details table.
I have a DB with 2 tables,
Deals
Deal
Not very elegant, but works in Oracle :
select dealid,
dealname,
dealdetails,
comment,
from
(
select a.dealid,
a.dealname,
a.dealdetails,
b.commenttime,
b.comment,
max(commenttime) over (partition by a.dealid) as maxCommentTime
from deals a inner join dealcomments b on b.dealid = a.dealid
)
where comment = maxCommentTime