I need to select an entity that is valid at the midth of the validity of different entity.
As a simplified example, I want to do something like this:
select
*
from
o1, o2
where
o1.from < (o2.to - ((o2.to - o2.from) /2) )
and
o1.to > (o2.to - ((o2.to - o2.from) /2) )
How can I compute "(o2.to - ((o2.to - o2.from) /2) )" in SQL, assuming that to and from are timestamps?