A little SQL problemo

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
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

A little SQL problemo

Post by Ree »

SELECT stamp FROM timecheck WHERE NOW() - 20 MINUTES > stamp.

I need to select all times (stamp field is TIMESTAMP) which are more than 20 minutes earlier than current time. I get MySQL syntax error. What is the problem?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

DATE_SUB() or do the math for it via conversion to UNIX timestamp of the parts..
Post Reply