ES
Size: a a a
ES
ЗА
ЗА
ЗА
H
H
ЗА
ЗА
H
select t2.id
from test t1,
test t2
where t1.id = t2.id - 1
and t1.status = 'OK'
and t2.status = 'neOK'
ЗА
H
t1.id = t2.id - 1
не подходитH
ЗА
H
H
ЗА
H
H
WITH deliveries AS (
SELECT h.id, h.delivery_id, h.change_date_time, h.delivery_status
FROM public.delivery_status_history h
WHERE h.delivery_id in (SELECT delivery_id FROM delivery_status_history WHERE delivery_status='DELIVERED')
)
SELECT *
FROM deliveries curr,
deliveries prev
WHERE curr.change_date_time > prev.change_date_time
AND prev.delivery_id = curr.delivery_id
AND curr.delivery_status = 'PARTIALLYDELIVERED'
AND prev.delivery_status = 'DELIVERED'
🤔ЗА