In postgres table named "Transactions", I am trying to count the number of J-type transactions for each month. The following is my query.

```
select to_char("Date", 'Mon/YYYY') as "Date",
sum(case when l_part LIKE 'J%' then count end) as "IDs"
  from (
         select left("Type",4)as l_part, count(*),"Date" from 
         "Transactions" group by "Date",l_part
        ) p group by "Date"

  order by min("Date");

```

However, several problems occur with my query. 

1) The number counted accumulates, so that every month's count also adds in the total count in all the months that have come before. However, I am just trying to count each month individually.

2) With this query, my output repeats some months (i.e., May 2015 my have 3 rows, 2 rows are empty, and 1 row has the actual count)

Any insights would be appreciated.