On 2014/07/17 06:56, Prashanth Anil Mascarenhas wrote:
Hi All,
I want to copy a row in same table. How can I achieve this?
Eg : Table(ID,name,place,comments)
1 ABD 121 None
2 ASD 141 None
Now I want to copy the table ID 2 to new table ID 3using sqlite3 commands.
INSERT INTO Table SELECT 3,name,place,comments FROM Table WHERE ID=2;
If the ID field is an autoincrement key or rowid alias this will also work to
automatically select the next number:
INSERT INTO Table SELECT null,name,place,comments FROM Table WHERE ID=2;
-- or --
INSERT INTO Table (name,place,comments) SELECT name,place,comments FROM Table
WHERE ID=2;
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users