Thanks Steve,
I will go back to using separate tables - Thanks

-----Original Message-----
From: Steve Farmer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 12:12 PM
To: Rubanowicz, Lisa; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Record Numbering - was SELECT MAX(ID) PLUS 1

Hi Lisa,

At 4:40 AM -0600 28/3/01, Rubanowicz, Lisa wrote:
>Can anyone help me on this one


>  >
>>  Here is the story.  I have a small web site running from mySQL.
>  > had it all in different tables then an ASP colleague said I should do
>  > one table and use SELECT MAX(sub_id) etc.

Well although MYSql is not truly a relational database your ASP 
colleague does not seem to know a lot about database design !!

If it was me I would use extra tables for the first few levels...

You can use a self referencing table (which is what you are trying to 
do) but IMHO the extra tables approach provides more speed and 

Otherwise I can't see a reason why the query you are trying should not

a better and (usually) faster approach is to use another table to 
store the record numbers eg..

Table - record_numbers

RECNUM_PKEY  (Primary Key) (this holds the Table ID or Key eg "L1", "L2"
RECNUM_VALUE (holds the next record number)

you could easily write a php function to get the next record number 
for any table..

This may be overkill for your project but it is very flexible .


"Minds are like parachutes, they work best when open"
Support free speech; visit

Heads Together Systems Pty Ltd
Email: [EMAIL PROTECTED]     Tel: 612 9982 6767     Fax: 612 9981 3081 

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to