select cols from table limit 1 order by mydate desc

(in other dbms this is select TOP 1 .... or select FIRST 1 .....)

On 5/31/06, Andy Matthews <[EMAIL PROTECTED]> 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:241857
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

Reply via email to