如何使用'insert'作为父级&创建嵌套查询'选择'作为孩子 [英] how to create nested query using 'insert' as parent & 'select' as child
问题描述
我想在Tech_allocation表中插入数据,其中dropdownlist中的tech_name来自New_tech表(从new_tech表绑定)。
AND
Complaint_no从另一个下拉列表中选择(来自Call_reg表的绑定),它来自表Call_reg表
所以我想选择complaint_no(来自Call_reg表),Tech_name(New_Tech表)&按钮点击插入Tech_allocation表..
有人可以帮忙......
I want to insert data into Tech_allocation table where tech_name which is in dropdownlist are from New_tech table(bind from new_tech table).
AND
Complaint_no selected from another dropdownlist(bind from Call_reg table) which is from table Call_reg table
So I want to select complaint_no (from Call_reg table), Tech_name(New_Tech table) & on button click insert into Tech_allocation table..
can somebody pls help...
推荐答案
使用选择插入 [ ^ ]
嗨
我想下面的查询可以帮到你:
Hi
I think bellow query can help you:
-----------------------------------------------------------------------------------
Insert [DestinationTable](FirstColumn, ...)
Select [SourceTable].[FirstColumn], ...
From [SourceTable]
Where Not Exists
(Select *
From [DestinationTable]
Where [IdentityColumn] = [SourceTable].[IdentityColumn]
)
-----------------------------------------------------------------------------------
我希望它有用。
I hope it''s helpful.
>
这篇关于如何使用'insert'作为父级&创建嵌套查询'选择'作为孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!