Maybe I'm just totally off the wall, but for things like:

SELECT * FROM myTable ORDER BY myDateValue DESC LIMIT 1

Doesn't mySQL automagically optimize your query, since you're only getting
one row back, and do it fast no matter how big your table is? Or is this
most definitively the /wrong/ way of doing it?

  ~ ross


On Mon, 20 Oct 2003, Jon Jensen wrote:

> Or I suppose if you want all pertinent information for that entry, you could
> do a query more like this:
>
> SELECT * FROM myTable WHERE myDateValue IN (SELECT MAX(myDateValue) FROM
> myTable) LIMIT 1
>
> The limit makes sure you just get one (in the event that there are multiple
> entries with the same date and they happen to be the last ones)


____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to