I have a table and i want statistics price of type a and type c as SELL, type b and type d as BUY by day the result like 

```
 Table :
   | Name |   type  |   price  |   day       |
   | n1   |   a     |     1    |2013-10-10   |
   | n2   |   b     |     2    |2013-10-10   |
   | n3   |   c     |     3    |2013-10-10   |
   | n4   |   d     |     4    |2013-10-10   |
   | n1   |   a     |     5    |2013-11-10   |
   | n2   |   b     |     6    |2013-11-10   |
   | n3   |   c     |     7    |2013-11-10   |
   | n4   |   d     |     8    |2013-11-10   |

```

and i want result like this

```
|  DAY       |    SELL (price a+price c)   |   BUY (price b +price d) |
|2013-10-10  |       4                     |         6                |
|2013-11-10  |       12                    |         14               |

```

Here my code 

```
ALTER proc [dbo].[sp_mysp]
@starttime datetime,
 @endtime datetime  
 as
   DECLARE @TIME DATETIME
   SET @TIME=@ENDTIME-@STARTTIME 
   SELECT  (table.day) AS DAY ,  case BUY
   WHEN TABLE.TYPE ='a' or TABLE.TYPE = 'c' THEN SUM (price) end,
   CASE SELL 
   WHEN TABLE.TYPE = 'b' or TABLE.TYPE = 'd' THEN SUM (price) end,

      FROM TABLE WHERE TABLE.DAY>@starttime AND TABLE.TIME<@ENDTIME
      order by TABLE.DAY

GO

```

I can't sum( type a and type c), sum (type b and type d) as i want, it only can sum by type a with a, b with b......
and i get result like 

```
 |  DAY       |    SELL (price a+price c)   |   BUY (price b +price d) | 
 | 2013-10-10 |         1                   |       NULL               |
 | 2013-10-10 |         3                   |       NULL               |
 | 2013-10-10 |         NULL                |       2                  |
 | 2013-10-10 |         NULL                |       4                  |
 | 2013-11-10 |         5                   |       NULL               |
 | 2013-11-10 |         7                   |       NULL               |
 | 2013-11-10 |        NULL                 |       6                  |
 | 2013-11-10 |        NULL                 |       8                  |

```

any sugesstion for me ?
sorry for my terrible english.