[Solved] SQL Union with group by and sum


try this :

select ID, count([Match ID]) as [TotalMatch ID] from 
(
SELECT  TblMatch.CustomerID1 as ID, TblMatch.[Match ID]
FROM TblMatch
UNION ALL
SELECT TblMatch.CustomerID2 as ID, TblMatch.[Match ID]
FROM TblMatch
) tmp
group by ID

0

solved SQL Union with group by and sum