hello Guys,
I facing a sql query problem which is i need to join many query into one query. That is :
a)
SELECT sum(Total) As [MONEY1]
FROM
((SELECT SUM(T1.Amount+T2.Amount) AS Total FROM TABLE1 T1 INNER TABLE2 T2 ON T1.ID = T2.ID) UNION ALL (SELECT SUM(T3.Amount+T4.Amount) AS Total FROM TABLE3 T3 INNER TABLE4 T4 ON T3.ID = T4.ID) ) DERIVETBL
b)
Select sum(AllTotal) as [MONEY2]
(SELECT SUM(T5.Total+T6.Total) AS ALLTotal FROM TABLE1 T5 INNER TABLE6 T6 ON T5.ID = T6.ID) UNION ALL
(SELECT SUM(T7.Total+T8.Total) AS ALLTotal FROM TABLE7 T7 INNER TABLE8 T8 ON T7.ID = T8.ID ) DERIVETBL
My Question is how i can combine (a) query and (b) query into into query, something like : SELECT 'Testing' as [Title] , [MONEY1] , [MONEY2]