我需要联接2个表(1.5KK和500K记录),但仅在第一个表的某些记录上。我试试这个
SELECT Table1.col1 AS NCol1, Table1.col2 AS NCol2, Table2.col1 AS NCol3
FROM Table1 LEFT JOIN Table2 ON Table1.col3 = Table2.col3
WHERE Table1.col1 = value
但是SQLite卡住了。我将数据库浏览器用于SQLite,但无法获得响应。
如果可以的话,效果很好
CREATE TEMP TABLE TEMP_JOIN AS
SELECT Table1.col1 AS NCol1, Table1.col2 AS NCol2, Table2.col1 AS NCol3
FROM Table1 LEFT JOIN Table2 ON Table1.col3 = Table2.col3;
SELECT * FROM TEMP_JOIN WHERE NCol1 = value
我想使用第一个代码,我需要做些什么修复才能使它工作?