如何从tabel插入到具有相同表的表 [英] How to insert from tabel to table with same table
本文介绍了如何从tabel插入到具有相同表的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hai all,
我需要写一个我试过但我收到错误的查询
Hai all,
I need to write a query i tried but i am getting errors
insert into ins_companyservicerates(CompanyId,BilltypeID,ServiceId,TestID,Rate,Code,Aliasname)
values(39,select billtypeid,serviceid,Testid,Rate,Code,Aliasname
from ins_companyservicerates where companyid = 31)
(我有一张表ins_companyservicerates和companyid = 31有超过500行。所以我需要用companyid = 39复制这些细节。
我该怎么做?
谢谢
Afsal
( I have a table ins_companyservicerates and companyid = 31 has more than 500 rows. So i need to copy this details with companyid = 39)
How can i do that?
Thanks
Afsal
推荐答案
试试吧:
Try this:
insert into ins_companyservicerates(CompanyId,BilltypeID,ServiceId,TestID,Rate,Code,Aliasname)
select 39, billtypeid,serviceid,Testid,Rate,Code,Aliasname
from ins_companyservicerates where companyid = 31
这篇关于如何从tabel插入到具有相同表的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文