Select a.*
from MON$ATTACHMENTS A
join MON$TRANSACTIONS T on T.MON$ATTACHMENT_ID = A.MON$ATTACHMENT_ID
join MON$STATEMENTS c on C.MON$ATTACHMENT_ID = A.MON$ATTACHMENT_ID
Where a.MON$TIMESTAMP <= '14.02.2024 12:50'
and MON$REMOTE_PROCESS = '/usr/sbin/php-fpm7.0'


Delete From mon$attachments Where MON$ATTACHMENT_ID in (
Select T.MON$ATTACHMENT_ID
from MON$ATTACHMENTS A
join MON$TRANSACTIONS T on T.MON$ATTACHMENT_ID = A.MON$ATTACHMENT_ID
join MON$STATEMENTS c on C.MON$ATTACHMENT_ID = A.MON$ATTACHMENT_ID
Where a.MON$TIMESTAMP <= '14.02.2024 12:50'
and MON$REMOTE_PROCESS = '/usr/sbin/php-fpm7.0'
)
