Snippets of MySQL tips, solutions, examples, tutorials, and even benchmarks
It's good to know, that mysql don't use the query cache when U R executing query with time functions like now() or date_sub... so if is posible, it's better to send query with exact time informations.
You should use NOW() instead of CURDATE() if you're pulling rows with a timestamp within the last 24 hours.Read this article for details:http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html
Good tips. I would also recommend using lowercase field names too with words separated by underscores.
i have a table order_master with a field of order_date(datetime) .please tell me how to get last four hour order from order_master
@anonymousSELECT * FROM table_order WHERE order_date > DATE_SUB(UTC_TIMESTAMP(), INTERVAL 4 HOUR);Ciao!
Post a Comment