Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timestamp advice needed !

Status
Not open for further replies.

rab54

Programmer
Jan 28, 2004
112
GB
Hi guys -

I need to pull out all recs that have been altered in the last 5 mins -

I have added a timestamp column -

Can I say -

SELECT name FROM details where timestamp BETWEEN NOW() and NOW (5 mins ago)

Any ideas ?

cheers

Rab
 
No.

First, because now() doesn't take input.

Second, because you could do it more efficiently. There's no point in checking for the upper bound now() when that is by definition always going to be the upper bound anyway.


SELECT name FROM details where timestamp_column > now() - interval 5 minute


Want the best answers? Ask the best questions: TANSTAAFL!!
 
AHA ! Thank you kind sir ! You are a genius ;-)

cheers

Rab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top