I need to move data from one table to another in my Android app
I would like to use the following sql:
insert into MYTABLE2 select id, STATUS risposta, DATETIME('now') data_ins from MYTABLE 2
Unfortunately in table MYTABLE2 there is an _ID column AUTOINCREMENT. What could I do?
Thanks.
EDIT: this is my MYTABLE2 the, the table I would like to populate with data from another table:
CREATE TABLE "ANSWERS" ("_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "ID_QUESTION" INTEGER,"DATE_INS" DATETIME DEFAULT (CURRENT_DATE) , "ANSWER" INTEGER)
If you want to inset the data manually(fully graphical) do the following: Go to the DDMS perspective. File explorer (tab-menu) Locate your db (/data/data/com.
You can use a select-statement within an INSERT statement to insert zero, one, or more rows into a table from the result table of the select-statement. The select-statement embedded in the INSERT statement is no different from the select-statement you use to retrieve data.
explicitly specify the column name in the INSERT
clause,
INSERT INTO destinationTable (risposta, data_ins) SELECT STATUS risposta, DATETIME('now') data_ins FROM sourceTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With