sql to get most recent records

How would I write the query for mySQL to get all the records in a table that
were written in tha last 10 minutes?

I have a timestamp field (fldTime) that automatically inserts the curent
time when the record is inserted, but I'm unsure how to write a query that
would only get records from the last 10 miniutes.

Any help would be appreciated.

Dave
dave [ Do, 03 August 2006 17:44 ] [ ID #1415883 ]

Re: sql to get most recent records

Dave wrote:
> I have a timestamp field (fldTime) that automatically inserts the curent
> time when the record is inserted, but I'm unsure how to write a query that
> would only get records from the last 10 miniutes.

SELECT ...
FROM tablename
WHERE fldTime > NOW() - INTERVAL 10 MINUTE

Regards,
Bill K.
Bill Karwin [ Do, 03 August 2006 21:12 ] [ ID #1415885 ]

Re: sql to get most recent records

That's great, thanks Bill

"Bill Karwin" <bill [at] karwin.com> wrote in message
news:eathrb11kj5 [at] enews2.newsguy.com...
> Dave wrote:
>> I have a timestamp field (fldTime) that automatically inserts the curent
>> time when the record is inserted, but I'm unsure how to write a query
>> that would only get records from the last 10 miniutes.
>
> SELECT ...
> FROM tablename
> WHERE fldTime > NOW() - INTERVAL 10 MINUTE
>
> Regards,
> Bill K.
dave [ Do, 03 August 2006 21:54 ] [ ID #1415886 ]
Datenbanken » mailing.database.mysql » sql to get most recent records

Vorheriges Thema: does "load index" help for fulltext search?
Nächstes Thema: yes/no data type