Jason Pruim wrote:
<snip>
I see what you are getting at with this, and have decided that mucking
around with auto incrementing values doesn't exactly fit in with the way
databases were designed to work.
Somehow though, I still need to supply this whether I end up adding a
"Record" number field in the database, and then through php (The way the
database is going to be accessed) assigned a record number to that field
based on the total rows, and display that number rather then the
internal record number.
This is getting complicated :)
The concept of sequential numbers only applies to people. If a row has a
unique identifier that's all you need to know to work with it.
For instance, if you have a list of 26 last names where each name starts
with a different letter of the alphabet. You could enter them in any
order you want and their ID values will be in apparently random order.
However to see the names sorted, you apply an ORDER BY clause to your
query. Now, the A name is #1 and the Z name is #26. Reverse that with
ORDER BY ... desc and the A name will be #26 and the Z name will be #1
in your output. What if you wanted to list just those names after 'K'?
Now the L name becomes #1. I hope this makes it clear that the concept
of sequential numbers is only nice for people. Computers and databases
don't need them to function well.
When you need to supply sequential numbers (as in popularity ranks) the
easiest way to do it is to return an ordered list then number them as
you output them with your client application.
--
Shawn Green, Support Engineer
MySQL Inc., USA, www.mysql.com
Office: Blountville, TN
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ /
/ /|_/ / // /\ \/ /_/ / /__
/_/ /_/\_, /___/\___\_\___/
<___/
Join the Quality Contribution Program Today!
http://dev.mysql.com/qualitycontribution.html
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]