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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving records by timestamp

Status
Not open for further replies.

JOBARAM

Programmer
May 25, 2002
52
IL
hi,
I have the following table:

ID |Type |TimeStampe

10 |1 |2005-04-25 16:37:58
10 |2 |2005-04-25 16:39:58
10 |3 |2005-04-25 16:38:58
10 |4 |2005-04-25 16:38:58


I need to create a query that will get me 2 types (limit 2) that have the oldest timestamp (1 and 3).

How do I do that?

Thanks

Jo
 
How about:
[tt]
SELECT * FROM tblname
ORDER BY timestampe
LIMIT 2
[/tt]
 
Hi Tony,
I have done some thing similar and it works:

SELECT
*
FROM
table_name
ORDER BY
datetime_field ASC
LIMIT 0, 2

Thanks mate

Jo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top