How do I do this query in MySQL? (datetime)
Translations
Englishالعربية
български
català
中文
čeština
dansk
Nederlands
eesti
suomi
français
Deutsch
Ελληνικά
עברית
हिंदी
magyar
Bahasa Indonesia
italiano
日本語
한국어
latviešu
lietuvių
norsk
polski
Português
română
русский
slovenčina
slovenski
español
svenska
ไทย
Türkçe
українська
Tiếng Việt
Suppose I have a datetime column in MySQL. How do I select all that have a datetime within 2500 seconds of the current datetime?
SELECT ALL where current_datetime - that_datetime < 2500 ...
This question and answers originated from www.stackoverflow.com
Question by TIMEX (3/17/2010 8:02:55 AM)
Answer |
SELECT * FROM Table WHERE that_datetime > NOW() - INTERVAL 2500 SECOND
You want to do all the function calls and operation on constants as MySQL won't use indexes for fields used in any kind of expressions.
Answer by vava
Find More Answers