RE: Mysql Rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
>You must have a column that is sequential in some way. An
>auto-incremented column, timestamp, or some other device that will
allow
>you to step through regardless of gaps in sequence. If you do not have
>such a column then you could add one.

You see, now that's the problem. If you have a field that has 
auto-increment and then delete a record, auto-increment does not go 
back and fill up the gaps.

As such, if you don't renumber, then the only thing left is to use a 
timestamp, I guess.
[/snip]

No, if you have gaps you can still step through sequentially, like 14,
15, 18, 19, 20...

[snip]

>The simplest example (most recent to oldest):
>
>select * from table order by datefield desc;
>
>
>To get them in the order they were entered:
>
>select * from table order by id asc;
>
>
>To get them in reverse order:
>
>select * from table order by id desc;

Which I could be used in such a way that you also provide a counter 
outside of mysql to show the user a number as they step through the 
records. However, the next time they want to review record xxx, it 
may not be in the same position because of deletions.
[/snip]

But if you never change the record number it will always have the same
record number. If someone searches for a particular record and it is not
there it has been deleted. Renumbering makes this far worse, because if
I am searching for record xxx and the table has been renumbered it may
now be record yy....I'd have no way of knowing.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux