Reputation: 127
I have two tables tbl_sbc and tbl_jdf both tables have the Users and Access fields. I want to create a new table based on the equality of the users from tbl_sbc and tbl_jdf and sum up the access.
Example
tbl_sbc
User Access
Foo 20
Bar 5
tbl_jdf
User Access
Foo 35
Beef 50
Output
User Access
Foo 55
Bar 5
Beef 50
How would I go about doing so? I can't seem to sum up the values
Upvotes: 0
Views: 52
Reputation: 12353
Here you go
Select User, Sum(Access) As Total from
(Select User , Access from tbl_sbc
Union All
Select User , Access from tbl_jdf)
Group by User
order by user desc
Upvotes: 2