Question: When compiling a library I get the following error related to the function below:

> 
> error: no matching function for call to ‘Factor::inplaceCancel(const
>  Factor\*&)’
> 
> 
> 

I don't understand why the `const Factor* rhsFPtr` is being treated as a `const Factor*&`.
Could anyone perhaps help me with this?

```
void InplaceCancelFF::inplaceProcess(FactorisedFactor* lhsPtr, const Factor* rhsFPtr){
   lhsPtr->factorPtrs[0]->inplaceCancel(rhsFPtr);
   ...
}
//In the abstract Factor Class:
virtual void inplaceCancel(const Factor* rhsPtr,FactorOperator* procPtr) = 0;
//In the child class:
inline void inplaceCancel(const Factor* rhsPtr, FactorOperator* procPtr = 0);

```

Answer: 
Get rid of `subscribers` column:

```
SELECT  [period],
        providerid, 
        [1] as SMS, 
        [2] as [Data], 
        [3] as [minutes]
FROM (
    SELECT [period],providerid, [type], volume
    FROM YourTable         
) as t
PIVOT (
    MAX(volume) FOR [type] in ([1], [2], [3]) 
) as P

```

Output:

```
period      providerid  SMS     Data    minutes
Aug-2016    7           4027917 5325430 8722165
Jul-2016    7           2981655 6449570 7702484

```
Your query would probably work if you use column names instead of constants:

```
SELECT period, providerid, [1] as SMS, [2] as Data, [3] as minutes
FROM #P         
PIVOT (sum(volume)
       FOR [type] in ([1], [2], [3]) 
      ) as P;

```

That said, I usually prefer to write these as conditional aggregations:

```
select period,
       sum(case when [type] = 1 then volume end) as SMS,
       sum(case when [type] = 2 then volume end) as data,
       sum(case when [type] = 3 then volume end) as minutes
from #p
group by period;

```