Combine two tables in SQLite
join, sqlite
Solution
Make a VIEW of the two tables. Write a `SELECT ... JOIN` statement that gives you the result you want, and then use that as the base for a VIEW.
Example:
CREATE VIEW
database.viewname
AS
SELECT
ta.key,
ta.col1,
tb.col2
FROM
ta
LEFT JOIN
tb
USING(key)
Problem
I have two tables, ta and tb: ta: ``` key col1 -------- k1 a k2 c ``` tb: ``` key col2 ------- k2 cc k3 ee ``` They connected by "key". I want to know how can I get a table, tc, like: ``` key col1 col2 ------------- k1 a k2 c cc k3 ee ``` Is there a easy method instead of inserting every record? They are one million records of tables so I need an effective way.