On Fri, Jun 25, 2010 at 02:42:45PM +0800, zeal scratched on the wall:
> Hi, CREATE TABLE Parent( ParentId INTEGER PRIMARY KEY AUTOINCREMENT,
> name TEXT, PRIMARY KEY (ParentId));CREATE TABLE Child( ChildId
> INTEGER PRIMARY KEY AUTOINCREMENT, ParentId INT, name TEXT,
> PRIMARY KEY(ChildId), FOREIGN KEY(ParentId) REFERENCES
> Parent(ParentId));after insert into Parent values('name1'); how to get
> parentId and set the parentId in table Child.Thanks,
> Zeal.
last_insert_rowid()
http://www.sqlite.org/lang_corefunc.html
-j
--
Jay A. Kreibich < J A Y @ K R E I B I.C H >
"Intelligence is like underwear: it is important that you have it,
but showing it to the wrong people has the tendency to make them
feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users