T-SQL中有类似于表变量的东西吗
DECLARE @ProductTotals TABLE
(
ProductID int,
Revenue money
)
然后在程序中,我可以:
INSERT INTO @ProductTotals (ProductID, Revenue)
SELECT ProductID, SUM(UnitPrice * Quantity)
FROM [Order Details]
GROUP BY ProductID
并像处理普通表格一样使用这个变量.