Select * From tableName Order by dateColumn desc Limit 1 --Ferg
Andy Matthews wrote: > I've got a table that's going to have records spanning a whole week. There's > a date field that I'm going to use as a filter to determine which records to > display (the most recent). How might I query to get the records with the > most recent date only? > > I'd prefer to have just one query, but as I'm running mySQL 4.0.17 that > might not be possible. This means I can't perform subqueries. > > so my records might be like this: > > 2006-05-31 creole 15 > 2006-05-31 andy 78 > 2006-05-30 creole 12 > 2006-05-30 andy 76 > > If I was adding in the data manually there would be no issue with what to > grab, but the question is further complicated by the data import that I'll > be performing once per day around 2am. This site is going to be used by > people internationally so I can never be sure WHAT day the person will have. > > So, if I suppose that I could do a query to get the MAX(date) from the > table, then a second query upon that value. But I'd love to see if there's a > better way first. > > Anyone? > > <!----------------//------ > andy matthews > web developer > certified advanced coldfusion programmer > ICGLink, Inc. > [EMAIL PROTECTED] > 615.370.1530 x737 > --------------//---------> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241860 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

