[blue]Select PayrollNo, MyName, SUM(MyPayement) As PaySum
From ([/blue]
SELECT [PayrollNo],[Name], [payment]
FROM [Table1]
UNION
SELECT [PayrollNo],[Name], [payment]
FROM [Table2][blue]
) Group By PayrollNo, MyName[/blue]
BTW - 'Name' is a bad name for a field.
Have fun.
---- Andy
A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
Like this ?
SELECT PayrollNo,[Name],Sum(payment) AS Total
FROM (SELECT [PayrollNo],[Name], [payment] FROM [Table1]
UNION SELECT [PayrollNo],[Name], [payment] FROM [Table2]) U
GROUP BY PayrollNo,[Name]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.