Potrzebuję znaleźć formularze (form_id= 6), które zostały zgłoszone w trakcie gdy status na orderze to był 'exeption'
mam taki kod, ale pokazuje mi również formularze, które były otwarte gdy zmienił się status. Ktoś ma pomysł jak to poprawić?
select *
from form_mesage as fm
where form_id = 6
and fm.time_create >= '2023-05-01'
and fm.time_create < '2023-06-01
and exists ( select 1
from order_status as os where os.order_id = fm.order_id
and os.status= 'exception'
and fm.time_create >= os.time_create)