[thelist] multiple rows in the MySQL with same value

Nan Harbison nan at nanharbison.com
Thu Jul 31 09:34:46 CDT 2008

Thanks, this is the answer. I didn't think of limit 1, even though I use it
all the time!!!
This is the problem working at home by myself, no one to bounce stuff off
Thank goodness for evolt.org!

-----Original Message-----
From: Fred Jones [mailto:fredthejonester at gmail.com] 
Sent: Thursday, July 31, 2008 7:13 AM
To: nan at nanharbison.com; thelist at lists.evolt.org
Subject: Re: [thelist] multiple rows in the MySQL with same value

> So the more general question I have is - when you do a query for a 
> value that is in a table more than once, does the query stop on the 
> first one it finds, so I should ORDER BY transaction date DESC? Or can 
> you not count on this?

You absolutely must use an ORDER BY clause. Nothing is else is guaranteed to
return results *every time* in the desired order.
Anyway, the standard and correct method is to use ORDER BY. You can then use
LIMIT 1 also to just get the first result. :)


More information about the thelist mailing list