[英]How can I insert new column where its value coming from another table?
I have 2 different table (Table A and Table B).我有 2 个不同的表(表 A 和表 B)。
Table A looks like this: enter image description here表 A 看起来像这样:在此处输入图像描述
Table B looks like this: enter image description here表 B 如下所示:在此处输入图像描述
I want to insert new column referred to productname in Table A, which its value based on productname in Table B.我想在表 A 中插入引用 productname 的新列,其值基于表 B 中的 productname。
How I can write the syntax?我如何编写语法?
I think what you need is to join the tables like this:我认为您需要的是像这样加入表格:
Select A.userid,
A.itemid,
A.insurance_amount,
A.productid,
B.productname
From A
Join B ON B.productid = A.productid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.