Best way to get ID
Posted: Thu Feb 21, 2008 10:55 am
I'm writing a program the INSERTS some data into an sql table(1). The table(1) has an ID that is key and autoincrements. I then want to INSERT some more data into another table(2) that has the same ID as table(1).
I'm not really sure how to do this. I could run a SELECT query but I normally use the ID and at that point I don't know what the ID is. How do I find out what the ID is for a record I've just inserted?
Thanks in advance.
I'm not really sure how to do this. I could run a SELECT query but I normally use the ID and at that point I don't know what the ID is. How do I find out what the ID is for a record I've just inserted?
Thanks in advance.