Re: [sqlite] INSERTing from another table data

2019-03-20 Thread Tim Streater
On 20 Mar 2019, at 00:35, Simon Davies wrote: > On Tue, 19 Mar 2019 at 15:07, Tim Streater wrote: >> >> My use case is a mixture of these. My need is to copy a row from a table in >> one db (db1) to a table with identical schema in another db (db2). The >> complication is that there is an id

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Simon Davies
On Tue, 19 Mar 2019 at 15:07, Tim Streater wrote: > > My use case is a mixture of these. My need is to copy a row from a table in > one db (db1) to a table with identical schema in another db (db2). The > complication is that there is an id column, so the row needs to get a new id > in db2. >

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Tim Streater
On 19 Mar 2019, at 13:46, R Smith wrote: > Three ways in SQL to create and fill a table with data from another: > > 1. CREATE ... AS > Example: > CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; > 2. CREATE TABLE + INSERT > Example: > CREATE TABLE newTable(a INT, b REAL, c TEXT); > INSERT

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Wow! Thanks. I did not know these choices. Now I do. ;-) From: sqlite-users on behalf of R Smith Sent: Tuesday, March 19, 2019 09:46 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] INSERTing from another table data I see the "ignore this" retraction, but

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread R Smith
I see the "ignore this" retraction, but I thought to mention the following any way, for future reference: Three ways in SQL to create and fill a table with data from another: 1. CREATE ... AS Example: CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; (This method has the advantage of being

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Ignore this. Sorry. I should always count to 10 before sending things. Apologies. From: sqlite-users on behalf of Jose Isaias Cabrera Sent: Tuesday, March 19, 2019 09:15 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] INSERTing from another

[sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Greetings. I have this table, create table a (a, b, c); insert into a values (1, 2, 3); insert into a values (2, 3, 4); insert into a values (3, 4, 5); insert into a values (4, 5, 6); insert into a values (5, 6, 7); insert into a values (6, 7, 8); and I also have this table, create

Re: [sqlite] Inserting from another table... (resolved)

2012-07-06 Thread Sam Carleton
Folks, I would like to thank one and all, I think this was a group effort. I changed the double quotes to single, changed the value into a select and then just ran the select part and found one NULL filed because I had the wrong category. Fixed that and left it as a select and all is well! Thank

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Keith Medcalf
lto:sqlite-users- > boun...@sqlite.org] On Behalf Of Keith Medcalf > Sent: Friday, 06 July, 2012 13:29 > To: General Discussion of SQLite Database > Subject: Re: [sqlite] Inserting from another table... > > > Does saying what you want to do this way work better

Re: [sqlite] Inserting from another table...

2012-07-06 Thread David Bicking
street.com> To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Sent: Thursday, July 5, 2012 11:03 PM Subject: [sqlite] Inserting from another table... I am working on converting my system table from one form to another.  The old form was one row per value with a category/key

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Keith Medcalf
Does saying what you want to do this way work better? insert into PP_VIEWER_SETTINGS (COMPANY_NAME, DSPNEXTPREVIOUS, ENABLE_CARTS, ENABLE_DEBUGINFO, ENABLE_FAVORITES, ENABLE_RIGHTCLICK, ENABLE_SLIDESHOW, ENABLE_TIMEOUT, EXIT_KVS, EXIT_PASSWORD,

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Pavel Ivanov
> The query does not seem to do anything, the table is empty after I run the > query. This can only mean that there was some error executing insert. It's written in a way that it just cannot leave empty table for any reason except error. You have all columns NOT NULL, so maybe dblookup doesn't

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Sam Carleton
Pavel, The goal is to get them all into one row, correct. The query does not seem to do anything, the table is empty after I run the query. One question... In the PP_VIEWER_SETTINGS, I have columns of different types, but in DBLookup all the values are varchar's. Since sqlite doesn't actually

Re: [sqlite] Inserting from another table...

2012-07-05 Thread Pavel Ivanov
The insert statement below should insert one row into table PP_VIEWER_SETTINGS. Does it do that? Is it what you called "does not work"? To insert several rows you need to write a huge join of dblookup to itself, so your insert statement should look like this: insert into PP_VIEWER_SETTINGS (...)

[sqlite] Inserting from another table...

2012-07-05 Thread Sam Carleton
I am working on converting my system table from one form to another. The old form was one row per value with a category/key/value (DBLookup) , the new form is a separate column for each value (PP_VIEWER_SETTINGS). I am trying to create an insert statement to run when the new table is created,