First of all, the statement
select distinct ..., last(...)
is somewhat strange because there can only be one last record so
distinct
has no use. I also don't know where
OMDIM1
is coming from, but I would try something like this:
select distinct t1.a, t1.b, t1.c from t1 where t1.a = (select last(t2.a) from t2)
It's not the most beautiful sql syntax but for the sake of this example will hopefully do.
Good luck!