how to auto_decrement a primary key?

2001-11-12 Thread yilmaz

Hi all,
i want to keep the track of row numbers to display the results , say, five
by five.
the most common way to do this is defining a column which is
auto_incrementing and not null.
but htere is a problem with this approach.
say, i have a table which stores the subject and contents of articles, and
it has a primary key, say pk.
since pk is auto incrementing , whenever a new article is added it will
increment by one.However, if
i delete an article ( a row) it will not decrement. So when i want to
display them five by five, i will
have trouble, because some numbers do not exist. In oracle there is an
imbedded variable called rownum,
so that you can workaround this. Is there a similar varible or a kind of
solution for this problem?
i am looking forward to your help, and suggestions.
many thanks in advance
cheers :)



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: how to auto_decrement a primary key?

2001-11-12 Thread Don Read


On 12-Nov-2001 yilmaz wrote:
 Hi all,
 i want to keep the track of row numbers to display the results , say, five
 by five.
 the most common way to do this is defining a column which is
 auto_incrementing and not null.
 but htere is a problem with this approach.
 say, i have a table which stores the subject and contents of articles, and
 it has a primary key, say pk.
 since pk is auto incrementing , whenever a new article is added it will
 increment by one.However, if
 i delete an article ( a row) it will not decrement. So when i want to
 display them five by five, i will
 have trouble, because some numbers do not exist. In oracle there is an
 imbedded variable called rownum,
 so that you can workaround this. Is there a similar varible or a kind of
 solution for this problem?
 i am looking forward to your help, and suggestions.
 many thanks in advance


look for LIMIT in the manual.

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php