Home > database >  Mysql update to update the statement, update a time field, the results for the combined with the oth
Mysql update to update the statement, update a time field, the results for the combined with the oth

Time:03-02

Mysql statement is as follows:
The UPDATE table_A SET
Time field field C + C=time (the time field - time field B)
WHERE the state=1

Is there any way to achieve this SQL?
Pray god give directions!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

If the time field. A, B and C belong to the same data, then use DATEADD (time field C, INTERVAL DATEDIFF (time fields A, time field A, 3) DAY try,

CodePudding user response:

reference 1st floor RINK_1 response:
if the time field. A, B and C belong to the same data, then use DATEADD (time field C, INTERVAL DATEDIFF (time fields A, time field, A 3) DAY A try,

Oh, thanks
The demand also need in the time field with time field B set an empty
The UPDATE table_A SET
Time field field C + C=time (the time field - time field B)
AND the time field A=null
AND the time field B=null
WHERE the state=1
This will have impact?

CodePudding user response:

refer to the second floor Harvey__chen response:
Quote: refer to 1st floor RINK_1 response:
if the time field. A, B and C belong to the same data, then use DATEADD (time field C, INTERVAL DATEDIFF (time fields A, time field, A 3) DAY A try,

Oh, thanks
The demand also need in the time field with time field B set an empty
The UPDATE table_A SET
Time field field C + C=time (the time field - time field B)
AND the time field A=null
AND the time field B=null
WHERE the state=1
This will have impact?


Does not affect,
  • Related