Question: I have 2 separate columns, 'ATFTE' and 'SATFTE'. Using these two columns, I have to perform division and store the result in a separate column (say Pyramid). I am trying to use isnull function, because in many cases, the denominator is 0 and bringing it in a subquery. It shows error - 'Invalid Column name' - ATFTE and SATFTE. How can I rectify it?

```
select isnull(ATFTE/SATFTE,0) as Pyramid
from dw_UtilizationPredictionReport
where WFMGrade in (
select WFMGrade,
    case 
        when WFMGrade IN ('P/PA','PAT','A') then sum(TotalFTE)
        else 0
    END as ATFTE,
    case
        when WFMGrade IN ('SA','M','SM','AD','D','SD','AVP','VP','SVP','EVP') 
        and WFMGrade NOT IN ('Cont') then sum(TotalFTE)
        else 0
    END as SATFTE
from dw_UtilizationPredictionReport
group by (WFMGrade)
)

```

Answer: 
Since you set your argument **newcoach** multiple times, parse\_str will only return the last one. If you want parse\_str to parse your variable as an array you need to supply it in this format with a '**[ ]**' suffix:

```
$newcoach = "newcoach[]=6&newcoach[]=11&newcoach[]=12&newcoach[]=13&newcoach[]=14";

```

**Example:**

```
<?php
  $newcoach = "newcoach[]=6&newcoach[]=11&newcoach[]h=12&newcoach[]=13&newcoach[]=14";
  $searcharray  = array();
  parse_str($newcoach, $searcharray);
  print_r($searcharray);
?>

```

**Outputs:**

```
Array ( [newcoach] => Array ( [0] => 6 [1] => 11 [2] => 12 [3] => 13 [4] => 14 ) )

```
Currently it is assigning the last value as all parameter have same name.

You can use `[]` after variable name , it will create newcoach array with all values within it.

```
$test = "newcoach[]=6&newcoach[]=11&newcoach[]=12&newcoach[]=13&newcoach[]=14";

echo '<pre>';
parse_str($test,$result);
print_r($result);

```

O/p:

```
Array
(
    [newcoach] => Array
        (
            [0] => 6
            [1] => 11
            [2] => 12
            [3] => 13
            [4] => 14
        )

)

```