Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite copy data from one table to another

Tags:

sql

sqlite

SQLITE

I have 2 tables "Source" and "Destination" that have the same fields. ID and COUNTRY, though they both have other fields too that are not in common.

I need to copy the Source.Country value to the Destination.Country where the join is on ID

For the life of me I can't make Sqlite do this.

In SQL Server etc this is a super simple task.

Ideas?

like image 552
Ian Vink Avatar asked Nov 27 '10 10:11

Ian Vink


People also ask

How do I merge two tables in SQLite?

Syntax. The syntax for the SQLite CROSS JOIN is: SELECT columns FROM table1 CROSS JOIN table2; NOTE: Unlike an INNER or OUTER join, a CROSS JOIN has no condition to join the 2 tables.

Can SQLite handle multiple connections?

The current version of SQLite handles multiple connections through its thread-mode options: single-thread, multi-thread, and serialized. Single-thread is the original SQLite processing mode, handling one transaction at a time, either a read or a write from one and only one connection.


1 Answers

INSERT INTO Destination SELECT * FROM Source; 

See SQL As Understood By SQLite: INSERT for a formal definition.

like image 88
joschi Avatar answered Oct 12 '22 12:10

joschi