0
我有一个查询。这个查询是每个产品的计算百分比。我在这个查询中创建了一个虚拟列,这个列名是'yüzde'。之后,如果产品id相同,我希望将yüzde列转移到另一个表中的另一列并更新查询。 我想我需要编写一个存储过程。我怎样才能做到这一点?如何将值传递到另一列与两个查询
SELECT [ProductVariantId] ,
count([ProductVariantId]) as bedensayısı,
count([ProductVariantId]) * 100.0/(SELECT Top 1 Count(*) as Total
FROM [Live_ADL].[dbo].[_INV_ProductCombinationAttributes]
Where Size LIKE '%[^0-9]%' and [StockQuantity]>0
Group by [ProductVariantId]
order by Total Desc) as yüzde
FROM [Live_ADL].[dbo].[_INV_ProductCombinationAttributes]
Where Size LIKE '%[^0-9]%' and [StockQuantity]>0
group by [ProductVariantId]
order by yüzde desc
谢谢。这工作 –