Mysql last hour data


I tried several ways I found here, but it spits out more than the last hour.



The table has a field t_timestamp with data like:



It is now 2018-06-29 01:55:04



Above was created although I used something like:



Where is my thinking error?



I believe the solution is to this is to use TIMESTAMPDIFF instead of the DATE_SUB. Try something like the following:



WHERE TIMESTAMPDIFF(SECONDS, now(), t_timestamp) < 3600000



Hope this helps.



Usage of MySQL TIMESTAMPDIFF



Demo :http://sqlfiddle.com/#!9/f5e2c3/8/0



Solution:






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

The Dalles, Oregon

眉山市

清晰法令