a,c,c_a三个表,c_a是中间表,要变更a表的download_flag字段为1,且c表的school_id = 1084,同时a表的file_name值为文件的

UPDATE a SET download_flag = 1 
WHERE a.`id` 
IN(SELECT a_id FROM c_a
   WHERE c_id IN(SELECT id FROM c WHERE school_id = 1084)
)
 AND (  a.file_name LIKE '%.xlsx' 
 OR  a.file_name LIKE '%.pdf' 
  OR a.file_name LIKE '%.pptx' 
  OR a.file_name LIKE '%.docx' 
  OR a.file_name LIKE '%.ppt' 
  OR a.file_name LIKE '%.jpg' 
  OR a.file_name LIKE '%.txt' 
  OR a.file_name LIKE '%.bmp' 
  OR a.file_name LIKE '%.gif')
  AND a.deleted IS FALSE