I have 2 tables, table A:
CategoryId | Qty
1 | 10
2 | 15
Table B:
SaleId | CategoryId | QtyReserved
1 | 1 | 2
2 | 1 | 1
3 | 2 | 5
I want to display result like this (joining both tables):
CategoryId | Qty | QtyReserved
1 | 10 | 3 ---> sum records (column QtyReserved) from table B
2 | 15 | 5
How can I possibly achieve this? Thank you.