MySQL - UPDATE query based on SELECT Query

后端 未结 11 2077
既然无缘
既然无缘 2020-11-21 23:58

I need to check (from the same table) if there is an association between two events based on date-time.

One set of data will contain the ending date-time of certain

11条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 00:58

    UPDATE [table_name] AS T1,
          (SELECT [column_name] 
            FROM [table_name] 
            WHERE [column_name] = [value]) AS T2 
      SET T1.[column_name]=T2.[column_name] + 1
    WHERE T1.[column_name] = [value];
    

提交回复
热议问题