The DATE_ADD() function adds a specified time interval to a date. All data in the current table will be incremented by one day: UPDATE ACT_BlockNum SET CreateTime = DATE_ADD(CreateTime, INTERVAL 1 DAY); All data in the current table is reduced by one day: UPDATE ACT_BlockNum SET CreateTime = DATE_ADD(CreateTime, INTERVAL -1 DAY); In order to prevent the database query from reporting an empty exception, when the query result is returned as an integer, it can be compared with 0. If it is empty, a 0 is returned to the customer, otherwise the result value of the query is returned. The sql is as follows SELECT IFNULL(SUM(Num),0) from DPEvent.ACT_BlockNum where CreateTime BETWEEN #startTime# AND #endTime#; MYSQL IFNULL(expr1,expr2) If expr1 is not NULL, IFNULL() returns expr1, otherwise it returns expr2. IFNULL() returns a numeric or string value, depending on the context in which it is used. Similar ones If expr is null, then isnull() returns 1, otherwise it returns 0. The update statement updates the values of multiple fields update @A set c1=b.c1 ,c2=b.c2,c3=b.c3 from @A a,@B b where a.id=2 and b.id=6 update A set (A.a2,A.a3) =(select B.b2,b.b3 from B where B.b1= A.a1 and A.a3=100 ) The above is what I introduced to you about MySQL to increase or decrease all the time in the current data table by a specified time interval. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time! You may also be interested in:
|
<<: How to bind domain name to nginx service
>>: A brief summary of vue keep-alive
1. Introduction Image maps allow you to designate...
1. Download the alpine image [root@DockerBrian ~]...
Table of contents 1. Preparation 2. Introduction ...
This article shares the specific code for JavaScr...
Vue uses Ref to get component instances across le...
MySQL SQL statement performance tuning simple exa...
Does color influence website visitors? A few year...
The operating environment of this tutorial: Windo...
Usually, there are two options when we develop Li...
Preface lvm (Logical Volume Manager) logical volu...
A mysql-like php switch case statement. select xx...
Table of contents Preface 1. Download a single fi...
Adding indexes can improve query efficiency. Addi...
This article example shares the specific code of ...
This article shares the specific code of the canv...