I have a table in postgresql which is log for warhouse activity:

```
productid   action qty               time
5436         in    30       2014-09-18 11:46:25.113862
5436         in    30       2014-09-18 11:46:25.113862
5436         in    30       2015-10-18 08:13:11.124452
5436         in    30       2015-10-18 10:15:22.541125
2048         in    20       2014-09-18 11:46:35.873401
2048         in    80       2014-09-18 11:46:35.873401
2048         out   20       2014-09-18 11:46:35.873401

```

`time` is `TIME STAMP WITHOUT TIME ZONE`

I want to get the `SUM` of `qty` (`in` only) per `productid` per day.
for the above table the result will be:

```
productid  qty      date
5436        60  2014-09-18
5436        60  2015-10-18
2048        80  2014-09-18

```

Normaly I would do:

```
Select sum(qty)
from A
where action like 'in'
group by (partid,time)

```

however that will not work as it doesn't know that `2015-10-18 08:13:11.124452` and `2015-10-18 10:15:22.541125` of product `5436` should be grouped together.