简体   繁体   English

在sqlite中加入两个表

[英]joining two table in sqlite

i have two table 表1数据 and table two data is 表2

and i want to show just like this

表3

I have to make a table out of two other tables one table with column word and serial and another with column meaning and serial . 我必须从另外两个表中创建一个表,一个表包含列wordserial ,另一个表具有列meaningserial

Now what I have to do is put this result(data) into table3 (a table i already have, with the same columns as in table1 and (table2) tried lots but can't please help me I hope this isn't too confusing of a question. 现在我要做的就是将此结果(数据)放入table3 (我已经有一个表,具有与表1和(表2)相同的列,但尝试了很多,但请不能帮我,我希望这不会太令人困惑一个问题。

select
  a.serial,
  b.word,
  a.word as meaning
from  tbl1 a
join tbl2 b on a.serial = b.serial

This is the sql query your looking for ,details related to the same is been provided in the link below 这是您要查找的sql查询,下面的链接中提供了与该查询有关的详细信息

INSERT INTO table3 (serial,word,meaning)
SELECT t1.serial,t2.word,t1.word 
FROM table1 as t1 
JOIN table2 as t2 ON t1.serial=t2.serial

click here w3schools SQL tutorial 点击这里w3schools SQL教程

尝试

select * from eng join other on eng.serial=other.serial

You can try something like: 您可以尝试如下操作:

INSERT INTO table (col_a, col_b) SELECT col_a, col_b FROM table_b JOIN table_c ON [argument] 

I'm not in my PC right now, so I can't make any elaborated code... 我现在不在电脑上,所以无法编写任何详细的代码...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM