Hi everyone, im new to SQL and have a question that someone can hopefully answer
If i am inserting a new record into a table that has an auto_increment field
in it, is it possible to get the value of that field returned automatically
instead of having to do a SELECT..
For example my user table has:
userid <-- auto_increment and primary key
username
So if i:
Insert into user (username) VALUES ('Test User');
i dont know what userid was assigned to that particular user and are having
to:
SELECT userid FROM user where username = 'Test User';
to get the id.
Is that the only way to do it?
hope it isnt a stupid question and thanks for any help in advance!
Cheers
Bob
---------------------------------
Yahoo! Photos NEW, now offering a quality print service from just 8p a photo.