2009/8/27 Igor Tandetnik <itandet...@mvps.org>:
> Or else, create the unique index on authors.author as originally
> planned, then use INSERT OR IGNORE to skip over errors.
> Igor Tandetnik

Super! I lost some hours for finding a solution today.
-- 
Kit


CREATE TABLE booklist(author TEXT, book TEXT);

CREATE TABLE authors(author TEXT);
CREATE TABLE books(authorID INT, book TEXT);
CREATE UNIQUE INDEX i_authors ON authors (author);

INSERT OR IGNORE INTO authors SELECT author FROM booklist;
INSERT INTO books (authorID, book)
   SELECT authors.rowid, booklist.book FROM authors,booklist
   WHERE authors.author=booklist.author;

meta keywords: insert into multiple tables
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to