我已经计算出不同表格中计数的总和。这是两次完成的,每次都针对
下面是我目前执行这两个总和的代码:
我得到的结果是:
performanceID
。现在我想得到这两个总和的总和。下面是我目前执行这两个总和的代码:
SELECT SUM((COUNT (BookingID) * CategoryPrice)) AS TotalAmount
FROM Booking, Production
WHERE Booking.PerformanceID IN(SELECT PerformanceID FROM Performance WHERE PerformanceID = '1')
and Production.ProductionID IN
(SELECT ProductionID FROM Performance WHERE PerformanceID = '1')
GROUP BY BookingID, CategoryPrice
UNION ALL
SELECT SUM((COUNT (BookingID) * CategoryPrice)) AS TotalAmount
FROM Booking, Production
WHERE Booking.PerformanceID IN(SELECT PerformanceID FROM Performance WHERE PerformanceID = '2')
and Production.ProductionID IN
(SELECT ProductionID FROM Performance WHERE PerformanceID = '2')
GROUP BY BookingID, CategoryPrice
我得到的结果是:
总金额 ----------- 70 60这里如何将两个总数相加呢?
WHERE per.performanceid in (1, 2, 3, 4) GROUP BY CategoryPrice ) - Davide Sousa