Home > database >  MYSQL query gets the current time, a record to reduce a second how to operate
MYSQL query gets the current time, a record to reduce a second how to operate

Time:09-19

The SELECT TIME, TIELE, from A

Want to display the results for the


The 2019-04-25 10:01:01 TITLE1
The 2019-04-25 10:01:02 TITLE2
The 2019-04-25 10:01:03 TITLE3
.
.


The first time for the system to the current time, behind each row reduce 1 s, ask the great spirit

CodePudding user response:

The following statements can be used as reference, 1 is 1 second, if want to go to a second, is 1,
The SELECT NOW () the time,
DATE_ADD (NOW (), the INTERVAL of 1 SECOND), the next SECOND
DATE_ADD (NOW (), 1 MINUTE INTERVAL) the next MINUTE,
DATE_ADD (NOW (), 1 HOUR INTERVAL) the next HOUR,
DATE_ADD (NOW (), the INTERVAL 1 DAY the next DAY,
DATE_ADD (NOW (), the INTERVAL 1 WEEK) next WEEK,
DATE_ADD (NOW (), 1 MONTH INTERVAL) next January,
DATE_ADD (NOW (), the INTERVAL 1 QUARTER) next QUARTER,
DATE_ADD (NOW (), the INTERVAL 1 YEAR) next YEAR.

CodePudding user response:

The SELECT NOW ()
DATE_ADD (NOW (), the INTERVAL of 1 SECOND).

CodePudding user response:

Visual inspection need the original poster is how to build this serial number?
Select @ rownum:=@ + 1 as rownum, rownum goodsId, goodscode from uniseq_vendor. Md_goods,
: (select @ rownum=0) t;



As for how to add a second, upstairs already reply
  • Related