[thelist] multiple rows in the MySQL with same value

Nan Harbison nan at nanharbison.com
Thu Jul 31 05:43:06 CDT 2008

Hi All,
On a website I am doing, we are keeping track of every transaction. So a
person signs up, gets a subscription number from authorize.net If their
credit card expires, that transaction is recorded in the payment table with
the same subscription number. To check to see if their credit card has
expired, I have to look at their most recent transaction. 
So if I query the table for the customer ID and subsccription number, how
can know I am choosing the latest transaction (the transaction date is
recorded as well)?
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? I can't seem to come up with the keywords to google this and get the
answer I am looking for.

More information about the thelist mailing list