5 Apr
2001
5 Apr
'01
6:17 p.m.
You need to get a book on SQL. Gitte Wange wrote -
Actually I need to add a new item to my database with one number higher than the item with the highest number, e.g. if there are an item in the database with number 2 then the new one must have number 3. And if there are no items then the new one must have number 1.
Say the table is "person", and the field that has the number is "id". Then select max(id) from person gives you the largest one. Or you could have the database calculate the next value for you: select 1+max(id) as next_id from person This will return a single row that has a single cell named "next_id". You should not just count the rows, since if you delete a row, the row count will not match the max id number. Tom P