from table a join table b on -- the primary key
where a.idNumber = b.idNumber
####
select abs(a.price - b.price) as difference
####
where a.date = (select max(Date) from table t1
where t1.idNumber = a.idNumber)
and
b.Date = (select max(Date) from table t2
where t2.idNumber = b.idNumber)
####
select
a.idNumber -- Presuming you want
, b.idNumber -- these too.
, abs(a.Price - b.Price) -- the price difference
from
table a join table b on SOMETHING -- the primary key
where
a.idNumber = b.idNumber
and a.date = (select max(Date) from table t1
where t1.idNumber = a.idNumber)
and b.Date = (select max(Date) from table t2
where t2.idNumber = b.idNumber)