Hi Marcus,
I understand this, but what I was hoping for was help with the actual query!
...however I think I've done it! Here it is. I hope it will help other people trying to do the same thing:
with ExistingItems as (
select mapping.Id, val.ProductVariantAttributeId, val.Alias, val.Name, val.ColorSquaresRgb, val.PriceAdjustment, val.WeightAdjustment, val.IsPreSelected, val.DisplayOrder, val.ValueTypeId, val.LinkedProductId, val.Quantity
from [dbo].[Product_ProductAttribute_Mapping] mapping
INNER JOIN
(
select * from [dbo].[ProductVariantAttributeValue] where ProductVariantAttributeId = 6
) val on mapping.Id = val.ProductVariantAttributeId
)
insert into [dbo].[ProductVariantAttributeValue] (ProductVariantAttributeId, Alias, Name, ColorSquaresRgb, PriceAdjustment, WeightAdjustment, IsPreSelected, DisplayOrder, ValueTypeId, LinkedProductId, Quantity)
select newItems.Id as ProductVariantAttributeId, ExistingItems.Alias, ExistingItems.Name, ExistingItems.ColorSquaresRgb, ExistingItems.PriceAdjustment, ExistingItems.WeightAdjustment, ExistingItems.IsPreSelected, ExistingItems.DisplayOrder, ExistingItems.ValueTypeId, ExistingItems.LinkedProductId, ExistingItems.Quantity from [dbo].[Product_ProductAttribute_Mapping] newItems
cross join ExistingItems
where newItems.Id > 15
The trick was to create a CTE to group all the existing items, then cross join that with all new entries in [dbo].[Product_ProductAttribute_Mapping].