[solved] return current row auto_increment value on insert?
Posted: Tue Feb 20, 2007 3:01 pm
example table:
id, int, auto_inc, primary key
data1, int
data2, varchar
...etc
Can I get the value of `id` when I insert a row somehow? Here's what I've currently got (basically):
--there won't be any duplicate entries, so this /should/ work, but..
I'd LIKE to do something like...
Is something like that possible?
id, int, auto_inc, primary key
data1, int
data2, varchar
...etc
Can I get the value of `id` when I insert a row somehow? Here's what I've currently got (basically):
Code: Select all
INSERT INTO `table` VALUES('','abc','def','ghi');
SELECT `id` FROM `table` WHERE `data1`='abc' AND `data2`='def' AND `data3`='ghi' LIMIT 1;I'd LIKE to do something like...
Code: Select all
INSERT INTO `table` VALUES('','abc','def','ghi') AND SELECT `id` FROM {this};