Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 使用多个表删除和更新查询_Mysql_Sql - Fatal编程技术网

Mysql 使用多个表删除和更新查询

Mysql 使用多个表删除和更新查询,mysql,sql,Mysql,Sql,我有以下select语句: select * from ( select q.*, qg.index_min as groupIndexMin, qg.index_max as groupIndexMax, fo.form_condition, fo.form_array,fo.form_index from question_gr

我有以下select语句:

select  *
from    (   select  q.*,
                qg.index_min as groupIndexMin,
                qg.index_max as groupIndexMax,
                fo.form_condition,
                fo.form_array,fo.form_index
            from question_group qg, question q
            right join form fo on q.form_id = fo.form_id
            where q.form_id=14 and
                 (q.question_group_id=qg.question_group_id and q.question_type_id NOT IN(12))
            order by question_order) m
 left join (select  r.response_text,
                    r.response_id,
                    r.response_index,
                    f.*,
                    a.*
             from   response r
             right outer join field f on r.field_id=f.field_id and r.response_index=5
             right outer join application a on r.application_id=a.application_id
             right outer join user u on a.user_id=u.user_id
             where  (a.application_id=70 and u.user_id=47)) n on m.field_id = n.field_id
order by m.question_order ;
现在我需要

  • 删除查询:对于上述使用相同条件选择查询,记录将被删除,其中response_index=5

  • 更新查询:假设我删除了response\u index=5,那么剩余的response\u索引将被更新。例如,response_index=6=>response_index=5,response_index=7=>response_index=6


  • 请帮帮我。

    不要给未涉及的产品贴标签@维尔穆鲁甘。我已经从标签中删除了无关的数据库产品。请为实际使用的数据库添加标记。请将查询格式化为多行,否则很难阅读。