select t1.*
from table t1
join (select nomer_zakaza, max(data_obnovleniya) max_DT, min(data_obnovleniya) min_DT
from table
group by nomer_zakaza) t2
on (t1.nomer_zakaza = t2.nomer_zakaza and t1.data_obnovleniya in (max_DT, min_DT))
order by t1.nomer_zakaza, t1.data_obnovleniya