MySQL ERROR: Column 'Time' cannot be null

前端 未结 2 2027
悲哀的现实
悲哀的现实 2021-01-29 02:38

I get the error: Column \'Time\' cannot be null when using the query below, it works fine the first time when there is no duplicate but then when trying to update again I get th

2条回答
  •  遇见更好的自我
    2021-01-29 02:57

    If there's no duplicate, then this query will do an insert, and the Time value will be null, as no value was ever set. Null + anything is null, hence the error.

    Try ... Time = COALESCE(Time, 0) + INTERVAL $time SECOND or similar to get aroun dit.

提交回复
热议问题