I've got 3 tables:

1. ProductMaster
2. SalesTY (Sales This Year)
3. SalesLY (Sales Last Year)

I'm trying to create a query which will return all the rows from the ProductMaster and then the sales from this year and then the sales from last year. The problem is some products from this year is new and some products from last year is not available anymore, but I've got to list all the prodcuts, so it must look like this:

```
Product    TY       LY
aaaa       1000     0
bbbb       0        1000

```

My query:

```
select 
i.Product
,b1.TrnMonth
,b1.TrnYear
,b1.TY
,b2.LY
from Productmaster i
left join #ty b1
on i.Product = b1.Product
left join #ly b2
on i.Product = b2.Product
Group by i.Product
,b1.TrnMonth
,b1.TrnYear

```