[PHP] Get highest value of key most efficiently

2001-07-02 Thread Kraa de Simon
Hi, SQL newbie... What is the most efficient way to get the highest value of a key value using the odbc_* functions/SQL syntax? E.g. if I have a table with key values 1,2,3...1567 I need the higest value: 1567 so I can create a new record and assign key value 1568. I don't want to read the

Re: [PHP] Get highest value of key most efficiently

2001-07-02 Thread Wieger Uffink
Hi, SELECT MAX(column_name) FROM table_name Though for what youre trying to do its better to use an autoincrementing field. That way the database will automaticly increment the key when you do an insert regards, wieger Kraa de Simon wrote: Hi, SQL newbie... What is the most efficient

[PHP] Good intro to SQL reference Was: Re: [PHP] Get highest value of key most efficiently

2001-07-02 Thread Aral Balkan
You might also want to reference James Hoffman's excellent Introduction to Structured Query Language (SQL Tutorial) page: http://w3.one.net/~jhoffman/sqltut.htm Aral :) __ ([EMAIL PROTECTED]) New Media Producer, Kismia, Inc. ([EMAIL PROTECTED]) Adj. Prof.,