473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

help with select statement where time <= 5min ago

Hi, i need some help with a select statement, i tried many different
MySQL fucntions and looked through the MySQL manual, and it didnt help
me any. What i want to do is select all rows from a table where my
time column(DATETIME) is less then or equal to 5 minutes ago from
now().

Any help is appreciated, thanks
Jul 20 '05 #1
1 6357
FuRiOuS1 wrote:
Hi, i need some help with a select statement, i tried many different
MySQL fucntions and looked through the MySQL manual, and it didnt help
me any. What i want to do is select all rows from a table where my
time column(DATETIME) is less then or equal to 5 minutes ago from
now().


# this will get you date_time 5 minutes ago
select DATE_SUB( now(), INTERVAL 5 MINUTE );

You can use <, >, =, >= or <= operators with dates also. So you can
compare the date in your table like this:

select * from table
where datetimefield <= DATE_SUB( now(), INTERVAL 5 MINUTE );

Read this page if you need more info about date and time functions:
http://dev.mysql.com/doc/mysql/en/Da...functions.html
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Guy Hocking | last post by:
Hi there, I have a problem in my ASP/SQL Server application i am developing, i hope you guys can help. I have a ASP form with list boxes populated by SQL tables. When a user selects a value...
0
by: Jorge Pinto | last post by:
Hello Folks, Please I need a help !!! Has anyone tried to save the returning of a select statement in the message body of the email ?? How did you do that !!! I'm having a hard time to do that....
0
by: FuRiOuS1 | last post by:
Hi, i need some help with a select statement, i tried many different MySQL fucntions and looked through the MySQL manual, and it didnt help me any. What i want to do is select all rows from a table...
2
by: ghasem | last post by:
Dear mySQL community, I have once again turned to the user groups for a problem I cannot solve myself! Atually, I have read all I can from the newsgroups on this but I could not solve it myself....
1
by: avinash | last post by:
hi myself avi i am developing one appliacaion in which i am using vb 6 as front end, adodb as database library and sql sever 7 as backend. i want to update one table for which i required data from...
2
by: GIS Analyst | last post by:
Hi to all I wish to be able to have a standard select statement which has additional fields added to it at run-time based on supplied parameter(s). ie declare @theTest1 nvarchar(10) set...
15
by: grunar | last post by:
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to...
8
by: flamesrock | last post by:
So, I was blazin' some mad chronix, as they say, and got on to thinking about Python. The question was, is the statement: time.time() < time.time() always true? Seems it should be false,...
1
by: ncsthbell | last post by:
Once again... I am supporting another Access database that I did not build. The previous 'owner' of this built the tables with spaces in the table names as well as the column names. I am having a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.