我在一个名为 #tempIQ 的临时表中有几个值,我想使用相同的组标识符插入一个名为 IQGroups 的表中。假设每个人都有一个独特的智商:
create table #tempIQ
(
id int
)
declare @GroupIDas int
set @GroupID=1001
select iq from #tempIQ
1,2,86,99,101,165,180,201
我想将临时表中的这些 id 插入一个名为 IQGroups 的分组中,但我很难找到一个简单的解决方案。
-- now try and insert all the iqs for a group into the IQGroups table from the #tempIQ table.
insert into IQGroups (GroupID, IQ) values (@GroupID, #tempiQ.iq)