sql - How can i use INSERT as subquery in SELECT statement in sqlite? -


i want this. dont know proper syntax.

select id table1 name = (insert table1 (name) values ('value_abcd')) 

so have table autoincrementing primary key, , want know value after have inserted record.

in sql, can use last_insert_rowid function:

insert table1(name) values('value_abcd'); select last_insert_rowid(); 

however, in cases not need execute separate select query because libraries have function return value. example, sqlite's c api has sqlite3_last_insert_rowid function, , android's insert function returns id directly.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -