herghost Posted September 12, 2010 Share Posted September 12, 2010 Hi all My database row that I am trying to select contains fields called id and date, the id field can contain more than one entry under an id, so I would like to be able to select the row by the latest date for this id. How would I do this? Cheers Link to comment https://forums.phpfreaks.com/topic/213211-select-by-id-and-date/ Share on other sites More sharing options...
trq Posted September 12, 2010 Share Posted September 12, 2010 Assuming your date field is named 'stamp' and the id your after is 4. SELECT fld FROM tbl WHERE id = 4 ORDER BY stamp DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/213211-select-by-id-and-date/#findComment-1110204 Share on other sites More sharing options...
herghost Posted September 12, 2010 Author Share Posted September 12, 2010 Perfect thorpe, thanks Link to comment https://forums.phpfreaks.com/topic/213211-select-by-id-and-date/#findComment-1110214 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.