Advertisement
Ihor0k

Untitled

Sep 4th, 2017
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.74 KB | None | 0 0
  1. delete
  2.     from file_blobs
  3.     where not exists (
  4.         select state
  5.             from process_events
  6.             join cases on process_events.case_id = cases.id
  7.             where
  8.                 (
  9.                     isnull(cases.resolved_timestamp)
  10.                     or
  11.                     cases.resolved_timestamp > (
  12.                         select create_time from INFORMATION_SCHEMA.TABLES
  13.                         where table_schema = 'perform' and table_name = 'process_files_logs'
  14.                     )
  15.                 ) and state like concat('%', sha1, '%')
  16.     ) and sha1 not in (
  17.         select sha1 from process_files_logs
  18.     ) and sha1 not in (
  19.         select sha1 from slides
  20.     ) and sha1 not in (
  21.         select sha1 from pdfs
  22.     );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement