DATETIME search - SOLVED

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
davidtee1
Forum Newbie
Posts: 18
Joined: Fri Jun 10, 2005 2:41 am

DATETIME search - SOLVED

Post by davidtee1 »

Hi group,

I have a database with a DATETIME field storing the timestamp when the record was created.

Records are added by a remote task from time to time.

I need a SELECT that can find all records created within the last 30 minutes. ie where "now() - timestamp <= 30 mins"

I can't figure out how so any help gratefully received.

Thanks,


David
Last edited by davidtee1 on Thu Jun 22, 2006 11:58 am, edited 1 time in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What DB are you using?
davidtee1
Forum Newbie
Posts: 18
Joined: Fri Jun 10, 2005 2:41 am

Post by davidtee1 »

MySQL 4.1.15
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

DATEDIFF() and DATESUB() may be of interest.
davidtee1
Forum Newbie
Posts: 18
Joined: Fri Jun 10, 2005 2:41 am

Post by davidtee1 »

Actually, TIMEDIFF is what I need. Thanks for the pointer...

D
Post Reply