- Where Developers Learn, Share, & Build Careers


Can datetime fields compare with mySQL and return time difference with the current date? I really do not know where to start from, if someone has any ideas, then tell me in the right direction.

Here's what I've tried before.

  SELECT * FROM `order` where 'datetime adoid' - now ()   

Basically what I am trying to get is to get the order that is saved in the database for more than 8 hours. Thanks!

If you want your query to have an opportunity to use an index in the Timetable column, You should not manipulate the column, but only on the other side:

  'order' from 'SELECT' where date was added & lt; Now () - Interval 8 hours;    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -