DATE_SUB (NOW (), INTERVAL5MINUTE) and DATE_FORMAT (DATE_SUB (NOW (), INTERVAL5MINUTE), bitsCN.com
DATE_SUB (NOW (), INTERVAL 5 MINUTE) and DATE_FORMAT (DATE_SUB (NOW (), INTERVAL 5 MINUTE), '% Y-% m-% d % H: % M: % S') [SQL] [root @ CactiEZ ~] # Time mysql-h 172.22.10.32-ucacti-P3316-pcacti-e "select count (*) from order. tbl_tieyou_order where order_time> DATE_SUB (NOW (), INTERVAL 5 MINUTE); "-N + ----- + | 112 | + ----- + real 0m0. 030 s user 0m0. 005 s sys 0m0. 003 s [root @ CactiEZ ~] # Time mysql-h 172.22.10.32-ucacti-P3316-pcacti-e "select count (*) from order. tbl_tieyou_order where order_time> DATE_FORMAT (DATE_SUB (NOW (), INTERVAL 5 MINUTE), '% Y-% m-% d % H: % M: % S '); -N "+ ---------- + | count (*) | + ---------- + | 365 | + ---------- + real 0m1. 602 s user 0m0. 008 s sys 0m0. 003 s DATE_SUB (NOW (), INTERVAL 5 MINUTE) DATE_FORMAT (DATE_SUB (NOW (), INTERVAL 5 MINUTE), '% Y-% m-% d % H: % M: % S ')
What about data inconsistency?
What are the differences between the two statements?
Intuition tells me that the format is incorrect, so I did the test myself.
Sure enough> The values are different,
Here, July can be compared with the> symbol after the month is converted into an ascii code.
In this case, the results will be different.
One is a purely numeric string, and the Middle month is in English. The difference is that the date of the English string is not good> or <这样的处理操作< p>
BitsCN.com