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
謝謝。這工作 –