[thelist] multiple rows in the MySQL with same value

Joel D Canfield joel at bizba6.com
Thu Jul 31 13:49:02 CDT 2008


> If you code the returned query as if there was only one row, 
> do you know which one it would be?

never leave it up to the db to decide. it's so easy (and a good habit)
to just say 'order  by myhappyfield desc' or whatever. the db shouldn't
care what order stuff is in; part of good db construction is that the
data can be dumped in willy nilly, and you'll apply sorting when you
extract the data.

which means, in a fairly lax laymans' sense, that if you've got
multiples of certain data, then yes, it would return a random record.

if you want to really grok this stuff, please o please buy Michael
Hernandez' "Database Design for Mere Mortals" 'cause it's superb.

joel




More information about the thelist mailing list